Compare commits
22 Commits
Accessible
...
jsd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e99fb1da7b | ||
|
|
a4156ea8c1 | ||
|
|
4e17e7d0b6 | ||
|
|
0b9f4a6066 | ||
|
|
88e2efb86c | ||
|
|
f70c006cd2 | ||
|
|
2d43318eeb | ||
|
|
464cfb0128 | ||
|
|
ccd9fea75c | ||
|
|
adbbf081d4 | ||
|
|
087895e0d4 | ||
|
|
f53236bbe5 | ||
|
|
4525a93346 | ||
|
|
92ce8e0953 | ||
|
|
4f506cbcbc | ||
|
|
53fed9d6ad | ||
|
|
a7fb2e53b5 | ||
|
|
cddacc3fc7 | ||
|
|
6f925ed79a | ||
|
|
91ff9d9174 | ||
|
|
cb5c11135f | ||
|
|
d02f29a398 |
@@ -1,32 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src build
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility
|
||||
SHORT_LIBNAME = access
|
||||
IS_COMPONENT = 1
|
||||
REQUIRES = xpcom string dom
|
||||
|
||||
CPPSRCS = nsAccessibilityFactory.cpp
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../src
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/libaccessibility_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/libchrome_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
-lgkgfx \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..
|
||||
MODULE=accessibility
|
||||
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
DLLNAME=accessibility
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsAccessibilityFactory.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS = $(LINCS) -I..\src # for implementation headers
|
||||
|
||||
LLIBS=\
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\accessibility_s.lib \
|
||||
$(DIST)\lib\timer_s.lib \
|
||||
$(DIST)\lib\gkgfxwin.lib \
|
||||
$(LIBNSPR)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nscore.h"
|
||||
|
||||
static NS_IMETHODIMP
|
||||
NS_ConstructAccessibilityService(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ASSERTION(aOuter == nsnull, "no aggregation");
|
||||
nsIAccessibilityService* accessibility;
|
||||
rv = NS_NewAccessibilityService(&accessibility);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Unable to construct chrome registry");
|
||||
return rv;
|
||||
}
|
||||
rv = accessibility->QueryInterface(aIID, aResult);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
|
||||
NS_RELEASE(accessibility);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// The list of components we register
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "AccessibilityService",
|
||||
NS_ACCESSIBILITY_SERVICE_CID,
|
||||
"@mozilla.org/accessibilityService;1",
|
||||
NS_ConstructAccessibilityService
|
||||
},
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE("nsAccessibilityModule", components);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,26 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..
|
||||
|
||||
DIRS= public src build
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
@@ -1,3 +0,0 @@
|
||||
nsIAccessibilityService.idl
|
||||
nsIAccessible.idl
|
||||
nsIMutableAccessible.idl
|
||||
@@ -1,41 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
XPIDL_MODULE= accessibility
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIAccessibilityService.idl \
|
||||
nsIAccessible.idl \
|
||||
nsIMutableAccessible.idl \
|
||||
nsIAccessibleEventReceiver.idl \
|
||||
nsIAccessibleEventListener.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..
|
||||
MODULE=accessibility
|
||||
XPIDL_MODULE=accessibility
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIAccessibilityService.idl \
|
||||
.\nsIAccessible.idl \
|
||||
.\nsIMutableAccessible.idl \
|
||||
.\nsIAccessibleEventReceiver.idl \
|
||||
.\nsIAccessibleEventListener.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
@@ -1,53 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsIMutableAccessible.idl"
|
||||
#include "nsIAtom.idl"
|
||||
|
||||
[scriptable, uuid(68D9720A-0984-42b6-A3F5-8237ED925727)]
|
||||
interface nsIAccessibilityService : nsISupports
|
||||
{
|
||||
nsIAccessible createRootAccessible(in nsISupports aPresShell, in nsISupports aFrame);
|
||||
nsIMutableAccessible createMutableAccessible(in nsISupports aNode);
|
||||
nsIAccessible createHTMLBlockAccessible(in nsIAccessible aAccessible, in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLSelectAccessible(in nsIAtom aAccessible, in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLTextAccessible(in nsISupports aFrame);
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
// for component registration
|
||||
// {DE401C37-9A7F-4278-A6F8-3DE2833989EF}
|
||||
#define NS_ACCESSIBILITY_SERVICE_CID \
|
||||
{ 0xde401c37, 0x9a7f, 0x4278, { 0xa6, 0xf8, 0x3d, 0xe2, 0x83, 0x39, 0x89, 0xef } }
|
||||
|
||||
extern nsresult
|
||||
NS_NewAccessibilityService(nsIAccessibilityService** aResult);
|
||||
%}
|
||||
@@ -1,205 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(B26FBE47-9A5F-42a1-822B-082461AE4D6D)]
|
||||
interface nsIAccessible : nsISupports
|
||||
{
|
||||
/* Can't use these javascript can't tell us if properties are undefined
|
||||
|
||||
readonly attribute nsIAccessible accParent;
|
||||
readonly attribute nsIAccessible accNextSibling;
|
||||
readonly attribute nsIAccessible accPreviousSibling;
|
||||
readonly attribute nsIAccessible accFirstChild;
|
||||
readonly attribute nsIAccessible accLastChild;
|
||||
readonly attribute long accChildCount;
|
||||
|
||||
attribute wstring accName;
|
||||
attribute wstring accValue;
|
||||
readonly attribute wstring accDescription;
|
||||
readonly attribute wstring accRole;
|
||||
readonly attribute unsigned long accState;
|
||||
readonly attribute wstring accHelp;
|
||||
readonly attribute wstring accDefaultAction;
|
||||
readonly attribute boolean accFocused;
|
||||
*/
|
||||
|
||||
nsIAccessible getAccParent();
|
||||
nsIAccessible getAccNextSibling();
|
||||
nsIAccessible getAccPreviousSibling();
|
||||
nsIAccessible getAccFirstChild();
|
||||
nsIAccessible getAccLastChild();
|
||||
|
||||
long getAccChildCount();
|
||||
wstring getAccName();
|
||||
wstring getAccValue();
|
||||
void setAccName(in wstring name);
|
||||
void setAccValue(in wstring value);
|
||||
|
||||
wstring getAccDescription();
|
||||
wstring getAccRole();
|
||||
unsigned long getAccState();
|
||||
unsigned long getAccExtState();
|
||||
wstring getAccDefaultAction();
|
||||
wstring getAccHelp();
|
||||
boolean getAccFocused();
|
||||
|
||||
nsIAccessible accGetAt(in long x, in long y);
|
||||
|
||||
nsIAccessible accNavigateRight();
|
||||
nsIAccessible accNavigateLeft();
|
||||
nsIAccessible accNavigateUp();
|
||||
nsIAccessible accNavigateDown();
|
||||
|
||||
void accGetBounds(out long x,
|
||||
out long y,
|
||||
out long width,
|
||||
out long height);
|
||||
|
||||
void accAddSelection();
|
||||
void accRemoveSelection();
|
||||
void accExtendSelection();
|
||||
void accTakeSelection();
|
||||
void accTakeFocus();
|
||||
void accDoDefaultAction();
|
||||
|
||||
// MSAA State flags - used for bitfield. More than 1 allowed.
|
||||
const unsigned long STATE_UNAVAILABLE = 0x00000001; // Disabled, maps to opposite of Java ENABLED, Gnome/ATK SENSITIVE?
|
||||
const unsigned long STATE_SELECTED = 0x00000002;
|
||||
const unsigned long STATE_FOCUSED = 0x00000004;
|
||||
const unsigned long STATE_PRESSED = 0x00000008;
|
||||
const unsigned long STATE_CHECKED = 0x00000010;
|
||||
const unsigned long STATE_MIXED = 0x00000020; // 3-state checkbox or toolbar button
|
||||
const unsigned long STATE_READONLY = 0x00000040; // Maps to opposite of Java/Gnome/ATK EDITABLE state
|
||||
const unsigned long STATE_HOTTRACKED = 0x00000080;
|
||||
const unsigned long STATE_DEFAULT = 0x00000100;
|
||||
const unsigned long STATE_EXPANDED = 0x00000200;
|
||||
const unsigned long STATE_COLLAPSED = 0x00000400;
|
||||
const unsigned long STATE_BUSY = 0x00000800;
|
||||
const unsigned long STATE_FLOATING = 0x00001000; // Children "owned" not "contained" by parent
|
||||
const unsigned long STATE_MARQUEED = 0x00002000;
|
||||
const unsigned long STATE_ANIMATED = 0x00004000;
|
||||
const unsigned long STATE_INVISIBLE = 0x00008000;
|
||||
const unsigned long STATE_OFFSCREEN = 0x00010000;
|
||||
const unsigned long STATE_SIZEABLE = 0x00020000;
|
||||
const unsigned long STATE_MOVEABLE = 0x00040000;
|
||||
const unsigned long STATE_SELFVOICING = 0x00080000;
|
||||
const unsigned long STATE_FOCUSABLE = 0x00100000;
|
||||
const unsigned long STATE_SELECTABLE = 0x00200000;
|
||||
const unsigned long STATE_LINKED = 0x00400000;
|
||||
const unsigned long STATE_TRAVERSED = 0x00800000;
|
||||
const unsigned long STATE_MULTISELECTABLE = 0x01000000; // Supports multiple selection
|
||||
const unsigned long STATE_EXTSELECTABLE = 0x02000000; // Supports extended selection
|
||||
const unsigned long STATE_ALERT_LOW = 0x04000000; // This information is of low priority
|
||||
const unsigned long STATE_ALERT_MEDIUM = 0x08000000; // This information is of medium priority
|
||||
const unsigned long STATE_ALERT_HIGH = 0x10000000; // This information is of high priority
|
||||
const unsigned long STATE_PROTECTED = 0x20000000; // Maps to Gnome's *Role* ATK_ROLE_PASSWD_TEXT, nothing for Java?
|
||||
const unsigned long STATE_HASPOPUP = 0x40000000; // New in MSAA 2.0
|
||||
|
||||
// Extended state flags (for now non-MSAA, for Java and Gnome/ATK support)
|
||||
// This is only the states that there isn't already a mapping for in MSAA
|
||||
// See www.accessmozilla.org/article.php?sid=11 for information on the mappings between accessibility API states
|
||||
const unsigned long STATE_INVALID = 0x00200000; // No explanation given
|
||||
const unsigned long STATE_ACTIVE = 0x00400000; // This window is currently the active window
|
||||
const unsigned long STATE_EXPANDABLE = 0x00800000; // An item that can be expanded, such as a tree item with children
|
||||
const unsigned long STATE_MODAL = 0x01000000; // Must do something with control before leaving it
|
||||
const unsigned long STATE_MULTI_LINE = 0x02000000; // Edit control that can take multiple lines
|
||||
const unsigned long STATE_SENSITIVE = 0x04000000; // No explanation given
|
||||
const unsigned long STATE_RESIZABLE = 0x08000000; // Object can be resized
|
||||
const unsigned long STATE_SHOWING = 0x10000000; // This object and all of it's ancestors are visible
|
||||
const unsigned long STATE_SINGLE_LINE = 0x20000000; // This text object can only contain 1 line of text
|
||||
const unsigned long STATE_TRANSIENT = 0x40000000; // Tells accessibility aid "Don't add event listener - this object doesn't generate any". For example, could be used with higher level containers.
|
||||
const unsigned long STATE_VERTICAL = 0x80000000; // Especially used for sliders and scrollbars
|
||||
|
||||
|
||||
/*
|
||||
// MSAA Roles - only one per nsIAccessible or IAccessible
|
||||
const unsigned long ROLE_TITLEBAR = 0x00000001;
|
||||
const unsigned long ROLE_MENUBAR = 0x00000002;
|
||||
const unsigned long ROLE_SCROLLBAR = 0x00000003;
|
||||
const unsigned long ROLE_GRIP = 0x00000004;
|
||||
const unsigned long ROLE_SOUND = 0x00000005;
|
||||
const unsigned long ROLE_CURSOR = 0x00000006;
|
||||
const unsigned long ROLE_CARET = 0x00000007;
|
||||
const unsigned long ROLE_ALERT = 0x00000008;
|
||||
const unsigned long ROLE_WINDOW = 0x00000009;
|
||||
const unsigned long ROLE_CLIENT = 0x0000000A;
|
||||
const unsigned long ROLE_MENUPOPUP = 0x0000000B;
|
||||
const unsigned long ROLE_MENUITEM = 0x0000000C;
|
||||
const unsigned long ROLE_TOOLTIP = 0x0000000D;
|
||||
const unsigned long ROLE_APPLICATION = 0x0000000E;
|
||||
const unsigned long ROLE_DOCUMENT = 0x0000000F;
|
||||
const unsigned long ROLE_PANE = 0x00000010;
|
||||
const unsigned long ROLE_CHART = 0x00000011;
|
||||
const unsigned long ROLE_DIALOG = 0x00000012;
|
||||
const unsigned long ROLE_BORDER = 0x00000013;
|
||||
const unsigned long ROLE_GROUPING = 0x00000014;
|
||||
const unsigned long ROLE_SEPARATOR = 0x00000015;
|
||||
const unsigned long ROLE_TOOLBAR = 0x00000016;
|
||||
const unsigned long ROLE_STATUSBAR = 0x00000017;
|
||||
const unsigned long ROLE_TABLE = 0x00000018;
|
||||
const unsigned long ROLE_COLUMNHEADER = 0x00000019;
|
||||
const unsigned long ROLE_ROWHEADER = 0x0000001A;
|
||||
const unsigned long ROLE_COLUMN = 0x0000001B;
|
||||
const unsigned long ROLE_ROW = 0x0000001C;
|
||||
const unsigned long ROLE_CELL = 0x0000001D;
|
||||
const unsigned long ROLE_LINK = 0x0000001E;
|
||||
const unsigned long ROLE_HELPBALLOON = 0x0000001F;
|
||||
const unsigned long ROLE_CHARACTER = 0x00000020;
|
||||
const unsigned long ROLE_LIST = 0x00000021;
|
||||
const unsigned long ROLE_LISTITEM = 0x00000022;
|
||||
const unsigned long ROLE_OUTLINE = 0x00000023;
|
||||
const unsigned long ROLE_OUTLINEITEM = 0x00000024;
|
||||
const unsigned long ROLE_PAGETAB = 0x00000025;
|
||||
const unsigned long ROLE_PROPERTYPAGE = 0x00000026;
|
||||
const unsigned long ROLE_INDICATOR = 0x00000027;
|
||||
const unsigned long ROLE_GRAPHIC = 0x00000028;
|
||||
const unsigned long ROLE_STATICTEXT = 0x00000029;
|
||||
const unsigned long ROLE_TEXT = 0x0000002A; // Editable, selectable, etc.
|
||||
const unsigned long ROLE_PUSHBUTTON = 0x0000002B;
|
||||
const unsigned long ROLE_CHECKBUTTON = 0x0000002C;
|
||||
const unsigned long ROLE_RADIOBUTTON = 0x0000002D;
|
||||
const unsigned long ROLE_COMBOBOX = 0x0000002E;
|
||||
const unsigned long ROLE_DROPLIST = 0x0000002F;
|
||||
const unsigned long ROLE_PROGRESSBAR = 0x00000030;
|
||||
const unsigned long ROLE_DIAL = 0x00000031;
|
||||
const unsigned long ROLE_HOTKEYFIELD = 0x00000032;
|
||||
const unsigned long ROLE_SLIDER = 0x00000033;
|
||||
const unsigned long ROLE_SPINBUTTON = 0x00000034;
|
||||
const unsigned long ROLE_DIAGRAM = 0x00000035;
|
||||
const unsigned long ROLE_ANIMATION = 0x00000036;
|
||||
const unsigned long ROLE_EQUATION = 0x00000037;
|
||||
const unsigned long ROLE_BUTTONDROPDOWN = 0x00000038;
|
||||
const unsigned long ROLE_BUTTONMENU = 0x00000039;
|
||||
const unsigned long ROLE_BUTTONDROPDOWNGRID = 0x0000003A;
|
||||
const unsigned long ROLE_WHITESPACE = 0x0000003B;
|
||||
const unsigned long ROLE_PAGETABLIST = 0x0000003C;
|
||||
const unsigned long ROLE_CLOCK = 0x0000003D;
|
||||
const unsigned long ROLE_SPLITBUTTON = 0x0000003E; // New in MSAA 2.0
|
||||
const unsigned long ROLE_IPADDRESS = 0x0000003F; // New in MSAA 2.0
|
||||
|
||||
*/
|
||||
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
|
||||
[scriptable, uuid(BEE49E7D-9D06-49bf-8984-1694C697D74F)]
|
||||
interface nsIAccessibleEventListener : nsISupports
|
||||
{
|
||||
const unsigned long EVENT_FOCUS = 0x8005;
|
||||
|
||||
void handleEvent(in unsigned long aEvent, in nsIAccessible aTarget);
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIAccessibleEventListener.idl"
|
||||
|
||||
[scriptable, uuid(AB331E47-4FAA-4a12-9480-9B480DD78B39)]
|
||||
interface nsIAccessibleEventReceiver : nsISupports
|
||||
{
|
||||
void addAccessibleEventListener(in nsIAccessibleEventListener aListener);
|
||||
void removeAccessibleEventListener(in nsIAccessibleEventListener aListener);
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s): pav
|
||||
*/
|
||||
|
||||
#include "nsIAccessible.idl"
|
||||
#include "nsIAtom.idl"
|
||||
|
||||
[scriptable, uuid(AD3274E5-9DD1-4614-81C8-BFF992869CBE)]
|
||||
interface nsIMutableAccessible : nsIAccessible
|
||||
{
|
||||
void SetNameAsNodeValue();
|
||||
void SetName(in wstring aName);
|
||||
void SetNameAsAttribute(in nsIAtom aAtom);
|
||||
void SetRole(in wstring aRole);
|
||||
void SetIsLeaf(in boolean aLeaf);
|
||||
};
|
||||
@@ -1,49 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_s
|
||||
REQUIRES = xpcom string layout widget dom view locale gfx2
|
||||
|
||||
CPPSRCS = \
|
||||
nsAccessible.cpp \
|
||||
nsAccessibilityService.cpp \
|
||||
nsMutableAccessible.cpp \
|
||||
nsRootAccessible.cpp \
|
||||
nsHTMLFormControlAccessible.cpp \
|
||||
nsHTMLTextAccessible.cpp \
|
||||
nsSelectAccessible.cpp \
|
||||
nsGenericAccessible.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
override NO_SHARED_LIB=1
|
||||
override NO_STATIC_LIB=
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,252 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsMutableAccessible.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsSelectAccessible.h"
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
|
||||
//--------------------
|
||||
|
||||
|
||||
nsAccessibilityService::nsAccessibilityService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsAccessibilityService::~nsAccessibilityService()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsAccessibilityService, nsIAccessibilityService);
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibilityService methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateRootAccessible(nsISupports* aPresContext, nsISupports* aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* f = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
|
||||
nsCOMPtr<nsIPresContext> c = do_QueryInterface(aPresContext);
|
||||
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> s;
|
||||
c->GetShell(getter_AddRefs(s));
|
||||
|
||||
NS_ASSERTION(s,"Error not presshell!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> wr = getter_AddRefs(NS_GetWeakReference(s));
|
||||
|
||||
*_retval = new nsRootAccessible(wr,f);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateMutableAccessible(nsISupports* aNode, nsIMutableAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsMutableAccessible(aNode);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLBlockAccessible(nsIAccessible* aAccessible, nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> n = do_QueryInterface(node);
|
||||
NS_ASSERTION(n,"Error non nsIContent passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresContext> c = do_QueryInterface(aPresContext);
|
||||
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> s;
|
||||
c->GetShell(getter_AddRefs(s));
|
||||
|
||||
NS_ASSERTION(s,"Error not presshell!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> wr = getter_AddRefs(NS_GetWeakReference(s));
|
||||
|
||||
*_retval = new nsHTMLBlockAccessible(aAccessible, n,wr);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLSelectAccessible(nsIAtom* aPopupAtom, nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> n = do_QueryInterface(node);
|
||||
NS_ASSERTION(n,"Error non nsIContent passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresContext> c = do_QueryInterface(aPresContext);
|
||||
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> s;
|
||||
c->GetShell(getter_AddRefs(s));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> wr = getter_AddRefs(NS_GetWeakReference(s));
|
||||
|
||||
*_retval = new nsSelectAccessible(aPopupAtom, nsnull, n, wr);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLCheckboxAccessible(shell,node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
|
||||
*_retval = new nsHTMLRadioButtonAccessible(shell,node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLButtonAccessible(shell,node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTextAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTextAccessible(shell, node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIPresShell** aShell, nsIDOMNode** aNode)
|
||||
{
|
||||
*aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
(*aRealFrame)->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
||||
*aNode = node;
|
||||
NS_ADDREF(*aNode);
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
content->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
*aShell = document->GetShellAt(0);
|
||||
NS_IF_ADDREF(*aShell);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewAccessibilityService(nsIAccessibilityService** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsAccessibilityService* a = new nsAccessibilityService();
|
||||
if (a == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(a);
|
||||
*aResult = a;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsAccessibilityService_h__
|
||||
#define __nsAccessibilityService_h__
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
class nsIDOMNode;
|
||||
|
||||
class nsAccessibilityService : public nsIAccessibilityService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAccessibilityService methods:
|
||||
NS_DECL_NSIACCESSIBILITYSERVICE
|
||||
|
||||
// nsAccessibilityService methods:
|
||||
nsAccessibilityService();
|
||||
virtual ~nsAccessibilityService();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
NS_IMETHOD GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIPresShell** aShell, nsIDOMNode** aContent);
|
||||
|
||||
};
|
||||
|
||||
#endif /* __nsIccessibilityService_h__ */
|
||||
@@ -1,995 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsRootAccessible.h"
|
||||
|
||||
//#define DEBUG_LEAKS
|
||||
|
||||
#ifdef DEBUG_LEAKS
|
||||
static gnsAccessibles = 0;
|
||||
#endif
|
||||
|
||||
|
||||
class nsFrameTreeWalker {
|
||||
public:
|
||||
nsFrameTreeWalker(nsIPresContext* aPresContext, nsAccessible* aOwner);
|
||||
nsIFrame* GetNextSibling(nsIFrame* aFrame);
|
||||
nsIFrame* GetPreviousSibling(nsIFrame* aFrame);
|
||||
nsIFrame* GetParent(nsIFrame* aFrame);
|
||||
nsIFrame* GetFirstChild(nsIFrame* aFrame);
|
||||
nsIFrame* GetLastChild(nsIFrame* aFrame);
|
||||
nsIFrame* GetChildBefore(nsIFrame* aParent, nsIFrame* aChild);
|
||||
PRInt32 GetCount(nsIFrame* aFrame);
|
||||
|
||||
static PRBool ShouldSkip(nsIPresContext* aContext, nsIAtom* aList, nsIFrame* aStart, nsIFrame* aNext);
|
||||
static void GetAccessible(nsIFrame* aFrame, nsCOMPtr<nsIAccessible>& aAccessible, nsCOMPtr<nsIContent>& aContent);
|
||||
|
||||
nsCOMPtr<nsIPresContext> mPresContext;
|
||||
nsCOMPtr<nsIAccessible> mAccessible;
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
nsAccessible* mOwner;
|
||||
};
|
||||
|
||||
nsFrameTreeWalker::nsFrameTreeWalker(nsIPresContext* aPresContext, nsAccessible* aOwner)
|
||||
{
|
||||
mPresContext = aPresContext;
|
||||
mOwner = aOwner;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetParent(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get parent\n");
|
||||
|
||||
nsIFrame* parent = nsnull;
|
||||
aFrame->GetParent(&parent);
|
||||
|
||||
// if no parent then we hit the root
|
||||
// just return that top frame
|
||||
if (!parent) {
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return aFrame;
|
||||
}
|
||||
|
||||
GetAccessible(parent, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
return parent;
|
||||
|
||||
return GetParent(parent);
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetNextSibling(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get next\n");
|
||||
|
||||
// get next sibling
|
||||
nsIFrame* next = nsnull;
|
||||
aFrame->GetNextSibling(&next);
|
||||
nsIAtom* list = nsnull;
|
||||
mOwner->GetListAtomForFrame(aFrame, list);
|
||||
|
||||
|
||||
// skip any frames with the same content node
|
||||
while(ShouldSkip(mPresContext, list, aFrame, next))
|
||||
next->GetNextSibling(&next);
|
||||
|
||||
|
||||
// if failed
|
||||
if (!next)
|
||||
{
|
||||
// if parent has content
|
||||
nsIFrame* parent = nsnull;
|
||||
aFrame->GetParent(&parent);
|
||||
|
||||
// if no parent fail
|
||||
if (!parent) {
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// fail if we reach a parent that is accessible
|
||||
GetAccessible(parent, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
{
|
||||
// fail
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
} else {
|
||||
// next on parent
|
||||
nsIFrame* n = GetNextSibling(parent);
|
||||
if (ShouldSkip(mPresContext, list, aFrame, n))
|
||||
return GetNextSibling(n);
|
||||
else
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
// if next has content
|
||||
GetAccessible(next, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
{
|
||||
// done
|
||||
return next;
|
||||
}
|
||||
|
||||
// if next doesn't have node
|
||||
|
||||
// call first on next
|
||||
nsIFrame* first = GetFirstChild(next);
|
||||
|
||||
// if found
|
||||
if (first) {
|
||||
if (ShouldSkip(mPresContext, list, aFrame, first))
|
||||
return GetNextSibling(first);
|
||||
else
|
||||
return first;
|
||||
}
|
||||
|
||||
// call next on next
|
||||
nsIFrame* n = GetNextSibling(next);
|
||||
if (ShouldSkip(mPresContext, list, aFrame, next))
|
||||
return GetNextSibling(n);
|
||||
else
|
||||
return n;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetFirstChild(nsIFrame* aFrame)
|
||||
{
|
||||
|
||||
//printf("Get first\n");
|
||||
|
||||
// get first child
|
||||
nsIFrame* child = nsnull;
|
||||
nsIAtom* list = nsnull;
|
||||
mOwner->GetListAtomForFrame(aFrame, list);
|
||||
aFrame->FirstChild(mPresContext, list, &child);
|
||||
|
||||
while(child)
|
||||
{
|
||||
// if first has a content node
|
||||
GetAccessible(child, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
{
|
||||
// done
|
||||
return child;
|
||||
} else {
|
||||
// call first on child
|
||||
nsIFrame* first = GetFirstChild(child);
|
||||
|
||||
// if succeeded
|
||||
if (first)
|
||||
{
|
||||
// return child
|
||||
return first;
|
||||
}
|
||||
}
|
||||
|
||||
// get next sibling
|
||||
nsIFrame* next;
|
||||
child->GetNextSibling(&next);
|
||||
|
||||
// skip children with duplicate content nodes
|
||||
nsIAtom* list = nsnull;
|
||||
mOwner->GetListAtomForFrame(child, list);
|
||||
|
||||
while(ShouldSkip(mPresContext, list, child, next))
|
||||
next->GetNextSibling(&next);
|
||||
|
||||
child = next;
|
||||
}
|
||||
|
||||
// fail
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetChildBefore(nsIFrame* aParent, nsIFrame* aChild)
|
||||
{
|
||||
nsIFrame* child = GetFirstChild(aParent);
|
||||
|
||||
// if the child is not us
|
||||
if (child == aChild) {
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame* prev = child;
|
||||
nsCOMPtr<nsIContent> prevContent = mContent;
|
||||
nsCOMPtr<nsIAccessible> prevAccessible = mAccessible;
|
||||
|
||||
while(child)
|
||||
{
|
||||
child = GetNextSibling(child);
|
||||
|
||||
if (child == aChild)
|
||||
break;
|
||||
|
||||
prev = child;
|
||||
prevContent = mContent;
|
||||
prevAccessible = mAccessible;
|
||||
}
|
||||
|
||||
mAccessible = prevAccessible;
|
||||
mContent = prevContent;
|
||||
return prev;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetPreviousSibling(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get previous\n");
|
||||
|
||||
nsIFrame* parent = GetParent(aFrame);
|
||||
|
||||
return GetChildBefore(parent, aFrame);
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetLastChild(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get last\n");
|
||||
|
||||
return GetChildBefore(aFrame, nsnull);
|
||||
}
|
||||
|
||||
PRInt32 nsFrameTreeWalker::GetCount(nsIFrame* aFrame)
|
||||
{
|
||||
|
||||
//printf("Get count\n");
|
||||
nsIFrame* child = GetFirstChild(aFrame);
|
||||
|
||||
PRInt32 count = 0;
|
||||
while(child)
|
||||
{
|
||||
count++;
|
||||
child = GetNextSibling(child);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void nsFrameTreeWalker::GetAccessible(nsIFrame* aFrame, nsCOMPtr<nsIAccessible>& aAccessible, nsCOMPtr<nsIContent>& aContent)
|
||||
{
|
||||
aContent = nsnull;
|
||||
aAccessible = nsnull;
|
||||
|
||||
aFrame->GetContent(getter_AddRefs(aContent));
|
||||
|
||||
if (!aContent)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
if (!document)
|
||||
return;
|
||||
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
nsIPresShell* shell = document->GetShellAt(0);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(aContent, &frame);
|
||||
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
aAccessible = do_QueryInterface(aFrame);
|
||||
|
||||
if (!aAccessible)
|
||||
aAccessible = do_QueryInterface(aContent);
|
||||
|
||||
// if (aAccessible)
|
||||
// printf("Found accessible!\n");
|
||||
}
|
||||
|
||||
PRBool nsFrameTreeWalker::ShouldSkip(nsIPresContext* aContext, nsIAtom* aList, nsIFrame* aStart, nsIFrame* aNext)
|
||||
{
|
||||
if (!aStart || !aNext)
|
||||
return PR_FALSE;
|
||||
|
||||
// is content the same? If so skip it
|
||||
nsCOMPtr<nsIContent> content1;
|
||||
nsCOMPtr<nsIContent> content2;
|
||||
|
||||
aStart->GetContent(getter_AddRefs(content1));
|
||||
aNext->GetContent(getter_AddRefs(content2));
|
||||
|
||||
if (content1 == content2 && content1 != nsnull) {
|
||||
// does it have childen? It it does then don't skip it
|
||||
nsIFrame* child = nsnull;
|
||||
aNext->FirstChild(aContext, aList, &child);
|
||||
if (child)
|
||||
return PR_FALSE;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class nsAccessible
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsAccessible::nsAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
// get frame and node
|
||||
mContent = aContent;
|
||||
mAccessible = aAccessible;
|
||||
mPresShell = aShell;
|
||||
|
||||
#ifdef DEBUG_LEAKS
|
||||
printf("nsAccessibles=%d\n", ++gnsAccessibles);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsAccessible::~nsAccessible()
|
||||
{
|
||||
#ifdef DEBUG_LEAKS
|
||||
printf("nsAccessibles=%d\n", --gnsAccessibles);
|
||||
#endif
|
||||
}
|
||||
|
||||
//NS_IMPL_ISUPPORTS2(nsAccessible, nsIAccessible, nsIAccessibleWidgetAccess);
|
||||
NS_IMPL_ISUPPORTS1(nsAccessible, nsIAccessible);
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccParent(aAccParent);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
walker.GetParent(GetFrame());
|
||||
|
||||
// if no content or accessible then we hit the root
|
||||
if (!walker.mContent || !walker.mAccessible)
|
||||
{
|
||||
*aAccParent = new nsRootAccessible(mPresShell);
|
||||
NS_ADDREF(*aAccParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aAccParent = CreateNewParentAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aAccParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
/* readonly attribute nsIAccessible accNextSibling; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccNextSibling(nsIAccessible * *aAccNextSibling)
|
||||
{
|
||||
// delegate
|
||||
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccNextSibling(aAccNextSibling);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
|
||||
nsIFrame* next = walker.GetNextSibling(GetFrame());
|
||||
|
||||
if (next && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccNextSibling = CreateNewNextAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccNextSibling);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccNextSibling = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accPreviousSibling; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccPreviousSibling(nsIAccessible * *aAccPreviousSibling)
|
||||
{
|
||||
// delegate
|
||||
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccPreviousSibling(aAccPreviousSibling);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
nsIFrame* prev = walker.GetPreviousSibling(GetFrame());
|
||||
|
||||
if (prev && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccPreviousSibling = CreateNewPreviousAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccPreviousSibling);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccPreviousSibling = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accFirstChild; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccFirstChild(nsIAccessible * *aAccFirstChild)
|
||||
{
|
||||
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccFirstChild(aAccFirstChild);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
nsIFrame* child = walker.GetFirstChild(GetFrame());
|
||||
|
||||
if (child && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccFirstChild = CreateNewFirstAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccFirstChild);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccFirstChild = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accFirstChild; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccLastChild(nsIAccessible * *aAccLastChild)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccLastChild(aAccLastChild);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
nsIFrame* last = walker.GetLastChild(GetFrame());
|
||||
|
||||
if (last && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccLastChild = CreateNewLastAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccLastChild);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccLastChild = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute long accChildCount; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccChildCount(PRInt32 *aAccChildCount)
|
||||
{
|
||||
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccChildCount(aAccChildCount);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
*aAccChildCount = walker.GetCount(GetFrame());
|
||||
} else
|
||||
*aAccChildCount = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccName(PRUnichar * *aAccName)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccName(aAccName);
|
||||
if (NS_SUCCEEDED(rv) && *aAccName != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aAccName = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccDefaultAction(PRUnichar * *aDefaultAction)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccDefaultAction(aDefaultAction);
|
||||
if (NS_SUCCEEDED(rv) && *aDefaultAction != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aDefaultAction = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::SetAccName(const PRUnichar * aAccName)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->SetAccName(aAccName);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute wstring accValue; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccValue(PRUnichar * *aAccValue)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccValue(aAccValue);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && *aAccValue != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aAccValue = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::SetAccValue(const PRUnichar * aAccValue) { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
/* readonly attribute wstring accDescription; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccDescription(PRUnichar * *aAccDescription)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccDescription(aAccDescription);
|
||||
if (NS_SUCCEEDED(rv) && *aAccDescription != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accRole; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccRole(PRUnichar * *aAccRole)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccRole(aAccRole);
|
||||
if (NS_SUCCEEDED(rv) && *aAccRole != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accState; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible)
|
||||
return mAccessible->GetAccState(aAccState);
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetAccExtState(PRUint32 *aAccExtState)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible)
|
||||
return mAccessible->GetAccExtState(aAccExtState);
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accHelp; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccHelp(PRUnichar * *aAccHelp)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccHelp(aAccHelp);
|
||||
if (NS_SUCCEEDED(rv) && *aAccHelp != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute boolean accFocused; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccFocused(PRBool *aAccFocused) { return NS_OK; }
|
||||
|
||||
/* nsIAccessible accGetChildAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsAccessible::AccGetAt(PRInt32 tx, PRInt32 ty, nsIAccessible **_retval)
|
||||
{
|
||||
PRInt32 x,y,w,h;
|
||||
AccGetBounds(&x,&y,&w,&h);
|
||||
if (tx > x && tx < x + w && ty > y && ty < y + h)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
GetAccFirstChild(getter_AddRefs(child));
|
||||
PRInt32 cx,cy,cw,ch;
|
||||
|
||||
while(child) {
|
||||
child->AccGetBounds(&cx,&cy,&cw,&ch);
|
||||
|
||||
if (tx > cx && tx < cx + cw && ty > cy && ty < cy + ch)
|
||||
{
|
||||
*_retval = child;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
child->GetAccNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
}
|
||||
|
||||
|
||||
*_retval = this;
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void accNavigateRight (); */
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateRight(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
/* void navigateLeft (); */
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateLeft(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
/* void navigateUp (); */
|
||||
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateUp(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
/* void navigateDown (); */
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateDown(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
|
||||
/* void addSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccAddSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccAddSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void removeSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccRemoveSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccRemoveSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void extendSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccExtendSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccExtendSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void takeSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccTakeSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccTakeSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void takeFocus (); */
|
||||
NS_IMETHODIMP nsAccessible::AccTakeFocus(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccTakeFocus();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void doDefaultAction (); */
|
||||
NS_IMETHODIMP nsAccessible::AccDoDefaultAction(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccDoDefaultAction();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
nsIFrame* frame = GetBoundsFrame();
|
||||
|
||||
if (!frame || !context)
|
||||
{
|
||||
*x = *y = *width = *height = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// sum up all rects of frames with the same content node
|
||||
nsRect r;
|
||||
nsIFrame* start = frame;
|
||||
nsIFrame* next = nsnull;
|
||||
start->GetNextSibling(&next);
|
||||
|
||||
start->GetRect(r);
|
||||
|
||||
while (nsFrameTreeWalker::ShouldSkip(context,nsnull, start, next))
|
||||
{
|
||||
nsRect r2;
|
||||
next->GetRect(r2);
|
||||
r.UnionRect(r,r2);
|
||||
next->GetNextSibling(&next);
|
||||
}
|
||||
|
||||
nsPoint offset(r.x,r.y);
|
||||
|
||||
frame->GetParent(&frame);
|
||||
|
||||
nsPoint pos(0,0);
|
||||
while(frame) {
|
||||
nsIScrollableView* scrollingView;
|
||||
nsIView* view;
|
||||
// XXX hack
|
||||
frame->GetView(context, &view);
|
||||
if (view) {
|
||||
nsresult result = view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollingView);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nscoord xoff = 0;
|
||||
nscoord yoff = 0;
|
||||
scrollingView->GetScrollPosition(xoff, yoff);
|
||||
offset.x -= xoff;
|
||||
offset.y -= yoff;
|
||||
}
|
||||
}
|
||||
|
||||
frame->GetOrigin(pos);
|
||||
offset += pos;
|
||||
frame->GetParent(&frame);
|
||||
}
|
||||
|
||||
float t2p;
|
||||
context->GetTwipsToPixels(&t2p);
|
||||
|
||||
*x = (PRInt32)(offset.x*t2p);
|
||||
*y = (PRInt32)(offset.y*t2p);
|
||||
*width = (PRInt32)(r.width*t2p);
|
||||
*height = (PRInt32)(r.height*t2p);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// helpers
|
||||
|
||||
nsIFrame* nsAccessible::GetBoundsFrame()
|
||||
{
|
||||
return GetFrame();
|
||||
}
|
||||
|
||||
nsIFrame* nsAccessible::GetFrame()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mContent, &frame);
|
||||
return frame;
|
||||
}
|
||||
|
||||
void nsAccessible::GetPresContext(nsCOMPtr<nsIPresContext>& aContext)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
|
||||
if (shell) {
|
||||
shell->GetPresContext(getter_AddRefs(aContext));
|
||||
} else
|
||||
aContext = nsnull;
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewParentAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
|
||||
// ------- nsHTMLBlockAccessible ------
|
||||
|
||||
nsHTMLBlockAccessible::nsHTMLBlockAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell):nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
nsIAccessible* nsHTMLBlockAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsHTMLBlockAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
/* nsIAccessible accGetAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsHTMLBlockAccessible::AccGetAt(PRInt32 tx, PRInt32 ty, nsIAccessible **_retval)
|
||||
{
|
||||
PRInt32 x,y,w,h;
|
||||
AccGetBounds(&x,&y,&w,&h);
|
||||
if (tx > x && tx < x + w && ty > y && ty < y + h)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
nsCOMPtr<nsIAccessible> smallestChild;
|
||||
PRInt32 smallestArea = -1;
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
GetAccFirstChild(getter_AddRefs(child));
|
||||
PRInt32 cx,cy,cw,ch;
|
||||
|
||||
while(child) {
|
||||
child->AccGetBounds(&cx,&cy,&cw,&ch);
|
||||
|
||||
// ok if there are multiple frames the contain the point
|
||||
// and they overlap then pick the smallest. We need to do this
|
||||
// for text frames.
|
||||
if (tx > cx && tx < cx + cw && ty > cy && ty < cy + ch)
|
||||
{
|
||||
if (smallestArea == -1 || cw*ch < smallestArea) {
|
||||
smallestArea = cw*ch;
|
||||
smallestChild = child;
|
||||
}
|
||||
}
|
||||
child->GetAccNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
}
|
||||
|
||||
if (smallestChild != nsnull)
|
||||
{
|
||||
*_retval = smallestChild;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = this;
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsAccessible_H_
|
||||
#define _nsAccessible_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
class nsIFrame;
|
||||
|
||||
class nsAccessible : public nsIAccessible
|
||||
// public nsIAccessibleWidgetAccess
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAccessibilityService methods:
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
|
||||
//NS_IMETHOD AccGetWidget(nsIWidget**);
|
||||
|
||||
public:
|
||||
nsAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessible();
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList) { aList = nsnull; }
|
||||
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
|
||||
virtual nsIAccessible* CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewParentAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIAccessible> mAccessible;
|
||||
};
|
||||
|
||||
/* Special Accessible that knows how to handle hit detection for flowing text */
|
||||
class nsHTMLBlockAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLBlockAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
protected:
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aFrame, nsIWeakReference* aShell);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,335 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWeakReference.h"
|
||||
|
||||
/* Implementation file */
|
||||
NS_IMPL_ISUPPORTS1(nsGenericAccessible, nsIAccessible)
|
||||
|
||||
nsGenericAccessible::nsGenericAccessible()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsGenericAccessible::~nsGenericAccessible()
|
||||
{
|
||||
/* destructor code */
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccParent (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccName (in wstring name); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccName(const PRUnichar *name)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccValue (in wstring value); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccValue(const PRUnichar *value)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDescription(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccHelp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccHelp(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* boolean getAccFocused (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFocused(PRBool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accGetAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateRight (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateRight(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateLeft (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateLeft(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateUp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateUp(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateDown (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateDown(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accAddSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccAddSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accRemoveSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccRemoveSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accExtendSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccExtendSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeFocus (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeFocus()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accDoDefaultAction (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccDoDefaultAction()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* unsigned long getAccExtState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//-------------
|
||||
// nsDOMAccessible
|
||||
//-------------
|
||||
|
||||
nsDOMAccessible::nsDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode)
|
||||
{
|
||||
mPresShell = getter_AddRefs(NS_GetWeakReference(aShell));
|
||||
mNode = aNode;
|
||||
}
|
||||
|
||||
|
||||
/* void accRemoveSelection (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccRemoveSelection()
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> control = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult rv = control->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
rv = mNode->GetParentNode(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = selection->Collapse(parent, 0);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void accTakeSelection (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccTakeSelection()
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> control = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult rv = control->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
rv = mNode->GetParentNode(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PRInt32 offsetInParent = 0;
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
rv = parent->GetFirstChild(getter_AddRefs(child));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> next;
|
||||
|
||||
while(child)
|
||||
{
|
||||
if (child == mNode) {
|
||||
// Collapse selection to just before desired element,
|
||||
rv = selection->Collapse(parent, offsetInParent);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// then extend it to just after
|
||||
rv = selection->Extend(parent, offsetInParent+1);
|
||||
return rv;
|
||||
}
|
||||
|
||||
child->GetNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
offsetInParent++;
|
||||
}
|
||||
|
||||
// didn't find a child
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void accTakeFocus (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccTakeFocus()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mNode);
|
||||
content->SetFocus(context);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------
|
||||
// nsLeafFrameAccessible
|
||||
//-------------
|
||||
|
||||
nsLeafDOMAccessible::nsLeafDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsDOMAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsGenericAccessible_H_
|
||||
#define _nsGenericAccessible_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
|
||||
/**
|
||||
* Basic implementation
|
||||
* supports nothing
|
||||
*/
|
||||
class nsGenericAccessible : public nsIAccessible
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
|
||||
public:
|
||||
nsGenericAccessible();
|
||||
virtual ~nsGenericAccessible();
|
||||
};
|
||||
|
||||
/**
|
||||
* And accessible that observes a dom node
|
||||
* supports:
|
||||
* - selection
|
||||
* - focus
|
||||
*/
|
||||
class nsDOMAccessible : public nsGenericAccessible
|
||||
{
|
||||
public:
|
||||
nsDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
|
||||
NS_IMETHOD AccTakeSelection(void);
|
||||
NS_IMETHOD AccTakeFocus(void);
|
||||
NS_IMETHOD AccRemoveSelection(void);
|
||||
|
||||
protected:
|
||||
nsIWeakReference* mPresShell;
|
||||
nsCOMPtr<nsIDOMNode> mNode;
|
||||
};
|
||||
|
||||
/* Leaf version of DOM Accessible
|
||||
* has no children
|
||||
*/
|
||||
class nsLeafDOMAccessible : public nsDOMAccessible
|
||||
{
|
||||
public:
|
||||
nsLeafDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,199 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsRootAccessible)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessibleEventReceiver)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleEventReceiver)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsAccessible)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsRootAccessible, nsAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsAccessible);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell, nsIFrame* aFrame):nsAccessible(nsnull,nsnull,aShell)
|
||||
{
|
||||
// mFrame = aFrame;
|
||||
mListener = nsnull;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::~nsRootAccessible()
|
||||
{
|
||||
RemoveAccessibleEventListener(mListener);
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccName(PRUnichar * *aAccName)
|
||||
{
|
||||
*aAccName = ToNewUnicode(NS_LITERAL_STRING("Mozilla Document"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// helpers
|
||||
nsIFrame* nsRootAccessible::GetFrame()
|
||||
{
|
||||
//if (!mFrame) {
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* root = nsnull;
|
||||
if (shell)
|
||||
shell->GetRootFrame(&root);
|
||||
|
||||
return root;
|
||||
//}
|
||||
|
||||
// return mFrame;
|
||||
}
|
||||
|
||||
nsIAccessible* nsRootAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return new nsHTMLBlockAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
*aAccParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accRole; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccRole(PRUnichar * *aAccRole)
|
||||
{
|
||||
*aAccRole = ToNewUnicode(NS_LITERAL_STRING("client"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void addAccessibleEventListener (in nsIAccessibleEventListener aListener); */
|
||||
NS_IMETHODIMP nsRootAccessible::AddAccessibleEventListener(nsIAccessibleEventListener *aListener)
|
||||
{
|
||||
if (!mListener)
|
||||
{
|
||||
// add an event listener to the document
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
shell->GetDocument(getter_AddRefs(document));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> receiver;
|
||||
if (NS_SUCCEEDED(document->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(receiver))) && receiver)
|
||||
{
|
||||
nsresult rv = receiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener *, this), NS_GET_IID(nsIDOMFocusListener));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
}
|
||||
}
|
||||
|
||||
// create a weak reference to the listener
|
||||
mListener = aListener;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void removeAccessibleEventListener (in nsIAccessibleEventListener aListener); */
|
||||
NS_IMETHODIMP nsRootAccessible::RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener)
|
||||
{
|
||||
if (mListener)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
if (!shell)
|
||||
return NS_OK;
|
||||
|
||||
shell->GetDocument(getter_AddRefs(document));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> erP;
|
||||
if (NS_SUCCEEDED(document->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP))) && erP)
|
||||
{
|
||||
nsresult rv = erP->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener *, this), NS_GET_IID(nsIDOMFocusListener));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
}
|
||||
}
|
||||
|
||||
mListener = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (mListener) {
|
||||
nsCOMPtr<nsIDOMEventTarget> t;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(t));
|
||||
|
||||
// create and accessible for the target
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(t);
|
||||
|
||||
if (!content)
|
||||
return NS_OK;
|
||||
|
||||
if (mCurrentFocus == content)
|
||||
return NS_OK;
|
||||
|
||||
mCurrentFocus = content;
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
if (!frame)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAccessible> a = do_QueryInterface(frame);
|
||||
|
||||
if (!a)
|
||||
a = do_QueryInterface(content);
|
||||
|
||||
nsCOMPtr<nsIAccessible> na = CreateNewAccessible(a, content, mPresShell);
|
||||
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, na);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsRootAccessible::Focus(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsRootAccessible::Blur(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsRootAccessible_H_
|
||||
#define _nsRootAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleEventReceiver.h"
|
||||
#include "nsIAccessibleEventListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
|
||||
class nsRootAccessible : public nsAccessible,
|
||||
public nsIAccessibleEventReceiver,
|
||||
public nsIDOMFocusListener
|
||||
|
||||
{
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public:
|
||||
nsRootAccessible(nsIWeakReference* aShell, nsIFrame* aFrame = nsnull);
|
||||
virtual ~nsRootAccessible();
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHOD GetAccName(PRUnichar * *aAccName);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccRole(PRUnichar * *aAccRole);
|
||||
|
||||
// ----- nsIAccessibleEventReceiver ------
|
||||
|
||||
NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
NS_IMETHOD RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
|
||||
// ----- nsIDOMEventListener --------
|
||||
virtual nsresult HandleEvent(nsIDOMEvent* anEvent);
|
||||
virtual nsresult Focus(nsIDOMEvent* aEvent);
|
||||
virtual nsresult Blur(nsIDOMEvent* aEvent);
|
||||
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
// not a com pointer. We don't own the listener
|
||||
// it is the callers responsibility to remove the listener
|
||||
// otherwise we will get into circular referencing problems
|
||||
nsIAccessibleEventListener* mListener;
|
||||
nsCOMPtr<nsIContent> mCurrentFocus;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,717 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsSelectAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsMutableAccessible.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIDOMMenuListener.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
class nsSelectChildAccessible : public nsAccessible,
|
||||
public nsIDOMMenuListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsSelectChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectChildAccessible();
|
||||
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccValue(PRUnichar **_retval);
|
||||
|
||||
virtual nsIAccessible* CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
// popup listener
|
||||
NS_IMETHOD Create(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Destroy(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
nsCOMPtr<nsIContent> mSelectContent;
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsSelectChildAccessible, nsAccessible, nsIDOMMenuListener)
|
||||
|
||||
class nsSelectWindowAccessible : public nsAccessible,
|
||||
public nsIDOMMenuListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsSelectWindowAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aPrev, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectWindowAccessible();
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccExtState(PRUint32 *_retval);
|
||||
|
||||
// popup listener
|
||||
NS_IMETHOD Create(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Destroy(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
// helpers
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
nsCOMPtr<nsIAccessible> mPrev;
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsSelectWindowAccessible, nsAccessible, nsIDOMMenuListener)
|
||||
|
||||
class nsSelectListAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsSelectListAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectListAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList);
|
||||
virtual nsIAccessible* CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
class nsListChildAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsListChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsListChildAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList);
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
nsCOMPtr<nsIContent> mSelectContent;
|
||||
};
|
||||
|
||||
//---------
|
||||
|
||||
nsSelectAccessible::nsSelectAccessible(nsIAtom* aPopupAtom,
|
||||
nsIAccessible* aAccessible,
|
||||
nsIContent* aContent,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mPopupAtom = aPopupAtom;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
// our value is our first child's value. Which is the combo boxes text.
|
||||
nsCOMPtr<nsIAccessible> text;
|
||||
nsresult rv = GetAccFirstChild(getter_AddRefs(text));
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!text) {
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// look at our role
|
||||
return text->GetAccValue(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("combo box"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
// get the last child. Wrap it with a connector that connects it to the window accessible
|
||||
nsCOMPtr<nsIAccessible> last;
|
||||
nsresult rv = nsAccessible::GetAccLastChild(getter_AddRefs(last));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!last) {
|
||||
// we have a parent but not previous
|
||||
*_retval = new nsSelectWindowAccessible(mPopupAtom, this, nsnull, nsnull, mContent, mPresShell);
|
||||
} else {
|
||||
*_retval = last;
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
// get the last child. Wrap it with a connector that connects it to the window accessible
|
||||
nsCOMPtr<nsIAccessible> first;
|
||||
nsresult rv = nsAccessible::GetAccFirstChild(getter_AddRefs(first));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!first) {
|
||||
*_retval = new nsSelectWindowAccessible(mPopupAtom, this, nsnull, nsnull, mContent, mPresShell);
|
||||
} else {
|
||||
*_retval = first;
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectAccessible::CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewLastAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectAccessible::CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsSelectChildAccessible(mPopupAtom, mContent, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
nsresult rv = nsAccessible::GetAccChildCount(_retval);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// always have one more that is our window child
|
||||
(*_retval)++;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
|
||||
nsSelectChildAccessible::nsSelectChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell):
|
||||
nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mPopupAtom = aPopupAtom;
|
||||
mSelectContent = aSelectContent;
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar* string = nsnull;
|
||||
|
||||
// look at our role
|
||||
rv = nsAccessible::GetAccRole(&string);
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoString role(string);
|
||||
|
||||
// if its the text in the combo box then
|
||||
// its value should be its name.
|
||||
if (role.EqualsIgnoreCase("text")) {
|
||||
rv = nsAccessible::GetAccName(_retval);
|
||||
} else {
|
||||
rv = nsAccessible::GetAccValue(_retval);
|
||||
}
|
||||
|
||||
delete string;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar* string = nsnull;
|
||||
|
||||
// look at our role
|
||||
rv = nsAccessible::GetAccRole(&string);
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoString role(string);
|
||||
|
||||
// any text in the combo box is static
|
||||
if (role.EqualsIgnoreCase("text")) {
|
||||
// if it the comboboxes text. Make it static
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("static text"));
|
||||
} else {
|
||||
rv = nsAccessible::GetAccRole(_retval);
|
||||
}
|
||||
|
||||
delete string;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar* string = nsnull;
|
||||
|
||||
// look at our role
|
||||
nsAccessible::GetAccRole(&string);
|
||||
nsAutoString role(string);
|
||||
|
||||
// if button then we need to make the name be open or close
|
||||
if (role.EqualsIgnoreCase("push button"))
|
||||
{
|
||||
// if its a button and not already registered,
|
||||
// register ourselves as a popup listener
|
||||
if (!mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mSelectContent);
|
||||
if (!eventReceiver) {
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
eventReceiver->AddEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
|
||||
// get the current state open or closed
|
||||
// set _retval to it.
|
||||
// notice its supposed to be reversed. Close if opened
|
||||
// and Open if closed.
|
||||
|
||||
if (mOpen)
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Close"));
|
||||
else
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Open"));
|
||||
|
||||
} else {
|
||||
/*rv = nsAccessible::GetAccName(_retval);*/
|
||||
rv = NS_ERROR_NOT_IMPLEMENTED;
|
||||
*_retval = nsnull;
|
||||
}
|
||||
|
||||
delete string;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsSelectChildAccessible::~nsSelectChildAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mSelectContent);
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::Create(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
printf("Open\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::Destroy(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectChildAccessible::CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewPreviousAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectChildAccessible::CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsSelectChildAccessible(mPopupAtom, mSelectContent, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
nsresult rv = nsAccessible::GetAccNextSibling(getter_AddRefs(next));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!next) {
|
||||
// ok no more siblings. Lets create our window
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsSelectWindowAccessible(mPopupAtom, parent, nsnull, nsnull, mSelectContent, mPresShell);
|
||||
} else {
|
||||
*_retval = next;
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//---------------------
|
||||
|
||||
|
||||
nsSelectWindowAccessible::nsSelectWindowAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aPrev, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
:nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
mPrev = aPrev;
|
||||
mPopupAtom = aPopupAtom;
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
nsSelectWindowAccessible::~nsSelectWindowAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mContent);
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::Create(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
printf("Open\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::Destroy(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// not not already one register ourselves as a popup listener
|
||||
|
||||
if (!mRegistered) {
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mContent);
|
||||
if (!eventReceiver) {
|
||||
*_retval = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = 0;
|
||||
return rv;
|
||||
}
|
||||
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
|
||||
// if open we are visible if closed we are invisible
|
||||
// set _retval to it.
|
||||
if (mOpen)
|
||||
*_retval |= STATE_DEFAULT;
|
||||
else
|
||||
*_retval |= STATE_INVISIBLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
*_retval=0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("window"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mPrev;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsSelectListAccessible(mPopupAtom, this, nsnull, mContent, mPresShell);
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsSelectListAccessible(mPopupAtom, this, nsnull, mContent, mPresShell);
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
*x = *y = *width = *height = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
*/
|
||||
|
||||
nsIFrame* nsSelectWindowAccessible::GetBoundsFrame()
|
||||
{
|
||||
// get our frame
|
||||
nsIFrame* frame = GetFrame();
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
// get its first popup child that should be the window
|
||||
frame->FirstChild(context, mPopupAtom, &frame);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
//----------
|
||||
|
||||
|
||||
nsSelectListAccessible::nsSelectListAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
:nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mPopupAtom = aPopupAtom;
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
void nsSelectListAccessible::GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mContent, &frame);
|
||||
if (aFrame == frame)
|
||||
aList = mPopupAtom;
|
||||
else
|
||||
aList = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return mParent->AccGetBounds(x,y,width,height);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("list"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectListAccessible::CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsListChildAccessible(mPopupAtom, mContent, this, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectListAccessible::CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsListChildAccessible(mPopupAtom, mContent, this, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
//--------
|
||||
|
||||
nsListChildAccessible::nsListChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell):
|
||||
nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
mPopupAtom = aPopupAtom;
|
||||
mSelectContent = aSelectContent;
|
||||
}
|
||||
|
||||
nsIAccessible* nsListChildAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsListChildAccessible(mPopupAtom, mSelectContent, mParent, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
void nsListChildAccessible::GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mSelectContent, &frame);
|
||||
if (aFrame == frame)
|
||||
aList = mPopupAtom;
|
||||
else
|
||||
aList = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsListChildAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("list item"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsListChildAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsSelectAccessible_h__
|
||||
#define __nsSelectAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsSelectAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsSelectAccessible(nsIAtom* aPopupAtom, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccValue(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
virtual ~nsSelectAccessible() {}
|
||||
virtual nsIAccessible* CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,175 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
nsHTMLFormControlAccessible::nsHTMLFormControlAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsLeafDOMAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
// go up tree get name of label if there is one.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, checked
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
*_retval = (checked ? STATE_CHECKED : 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --- checkbox -----
|
||||
|
||||
nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("check box"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
// check or uncheck
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
if (checked)
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Check"));
|
||||
else
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("UnCheck"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void accDoDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoDefaultAction()
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
element->SetChecked(checked ? PR_FALSE : PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//------ Radio button -------
|
||||
|
||||
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Select"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("radio button"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::AccDoDefaultAction()
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
element->Click();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ----- Button -----
|
||||
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Press"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("push button"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> button = do_QueryInterface(mNode);
|
||||
|
||||
if (!button)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString name;
|
||||
button->GetValue(name);
|
||||
name.CompressWhitespace();
|
||||
|
||||
*_retval = name.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::AccDoDefaultAction()
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
element->Click();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLFormControlAccessible_H_
|
||||
#define _nsHTMLFormControlAccessible_H_
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
|
||||
class nsICheckboxControlFrame;
|
||||
|
||||
/* Accessible for supporting for controls
|
||||
* supports:
|
||||
* - walking up to get name from label
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLFormControlAccessible : public nsLeafDOMAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLFormControlAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsHTMLCheckboxAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLCheckboxAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
};
|
||||
|
||||
class nsHTMLRadioButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLRadioButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
};
|
||||
|
||||
class nsHTMLButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsICheckboxControlFrame.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIPresShell* aShell, nsIDOMNode* aDomNode):
|
||||
nsLeafDOMAccessible(aShell, aDomNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
nsAutoString value;
|
||||
mNode->GetNodeValue(value);
|
||||
value.CompressWhitespace();
|
||||
*_retval = value.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
nsAutoString role(NS_LITERAL_STRING("text"));
|
||||
*_retval = role.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLTextAccessible_H_
|
||||
#define _nsHTMLTextAccessible_H_
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
class nsITextControlFrame;
|
||||
|
||||
class nsHTMLTextAccessible : public nsLeafDOMAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLTextAccessible(nsIPresShell* aShell, nsIDOMNode* aDomNode);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIDOMNode> mDomNode;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,53 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..
|
||||
MODULE=accessibility
|
||||
LIBRARY_NAME=accessibility_s
|
||||
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsAccessible.obj \
|
||||
.\$(OBJDIR)\nsRootAccessible.obj \
|
||||
.\$(OBJDIR)\nsMutableAccessible.obj \
|
||||
.\$(OBJDIR)\nsAccessibilityService.obj \
|
||||
.\$(OBJDIR)\nsSelectAccessible.obj \
|
||||
.\$(OBJDIR)\nsGenericAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLFormControlAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLTextAccessible.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS= \
|
||||
-I..\..\layout\html\forms\public \
|
||||
-I..\..\layout\html\forms\src \
|
||||
-I..\..\layout\html\base\src \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,252 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsMutableAccessible.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsSelectAccessible.h"
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
|
||||
//--------------------
|
||||
|
||||
|
||||
nsAccessibilityService::nsAccessibilityService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsAccessibilityService::~nsAccessibilityService()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsAccessibilityService, nsIAccessibilityService);
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibilityService methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateRootAccessible(nsISupports* aPresContext, nsISupports* aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* f = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
|
||||
nsCOMPtr<nsIPresContext> c = do_QueryInterface(aPresContext);
|
||||
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> s;
|
||||
c->GetShell(getter_AddRefs(s));
|
||||
|
||||
NS_ASSERTION(s,"Error not presshell!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> wr = getter_AddRefs(NS_GetWeakReference(s));
|
||||
|
||||
*_retval = new nsRootAccessible(wr,f);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateMutableAccessible(nsISupports* aNode, nsIMutableAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsMutableAccessible(aNode);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLBlockAccessible(nsIAccessible* aAccessible, nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> n = do_QueryInterface(node);
|
||||
NS_ASSERTION(n,"Error non nsIContent passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresContext> c = do_QueryInterface(aPresContext);
|
||||
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> s;
|
||||
c->GetShell(getter_AddRefs(s));
|
||||
|
||||
NS_ASSERTION(s,"Error not presshell!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> wr = getter_AddRefs(NS_GetWeakReference(s));
|
||||
|
||||
*_retval = new nsHTMLBlockAccessible(aAccessible, n,wr);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLSelectAccessible(nsIAtom* aPopupAtom, nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> n = do_QueryInterface(node);
|
||||
NS_ASSERTION(n,"Error non nsIContent passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresContext> c = do_QueryInterface(aPresContext);
|
||||
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> s;
|
||||
c->GetShell(getter_AddRefs(s));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> wr = getter_AddRefs(NS_GetWeakReference(s));
|
||||
|
||||
*_retval = new nsSelectAccessible(aPopupAtom, nsnull, n, wr);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLCheckboxAccessible(shell,node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
|
||||
*_retval = new nsHTMLRadioButtonAccessible(shell,node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLButtonAccessible(shell,node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTextAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTextAccessible(shell, node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIPresShell** aShell, nsIDOMNode** aNode)
|
||||
{
|
||||
*aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
(*aRealFrame)->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
||||
*aNode = node;
|
||||
NS_ADDREF(*aNode);
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
content->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
*aShell = document->GetShellAt(0);
|
||||
NS_IF_ADDREF(*aShell);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewAccessibilityService(nsIAccessibilityService** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsAccessibilityService* a = new nsAccessibilityService();
|
||||
if (a == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(a);
|
||||
*aResult = a;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsAccessibilityService_h__
|
||||
#define __nsAccessibilityService_h__
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
class nsIDOMNode;
|
||||
|
||||
class nsAccessibilityService : public nsIAccessibilityService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAccessibilityService methods:
|
||||
NS_DECL_NSIACCESSIBILITYSERVICE
|
||||
|
||||
// nsAccessibilityService methods:
|
||||
nsAccessibilityService();
|
||||
virtual ~nsAccessibilityService();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
NS_IMETHOD GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIPresShell** aShell, nsIDOMNode** aContent);
|
||||
|
||||
};
|
||||
|
||||
#endif /* __nsIccessibilityService_h__ */
|
||||
@@ -1,995 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsRootAccessible.h"
|
||||
|
||||
//#define DEBUG_LEAKS
|
||||
|
||||
#ifdef DEBUG_LEAKS
|
||||
static gnsAccessibles = 0;
|
||||
#endif
|
||||
|
||||
|
||||
class nsFrameTreeWalker {
|
||||
public:
|
||||
nsFrameTreeWalker(nsIPresContext* aPresContext, nsAccessible* aOwner);
|
||||
nsIFrame* GetNextSibling(nsIFrame* aFrame);
|
||||
nsIFrame* GetPreviousSibling(nsIFrame* aFrame);
|
||||
nsIFrame* GetParent(nsIFrame* aFrame);
|
||||
nsIFrame* GetFirstChild(nsIFrame* aFrame);
|
||||
nsIFrame* GetLastChild(nsIFrame* aFrame);
|
||||
nsIFrame* GetChildBefore(nsIFrame* aParent, nsIFrame* aChild);
|
||||
PRInt32 GetCount(nsIFrame* aFrame);
|
||||
|
||||
static PRBool ShouldSkip(nsIPresContext* aContext, nsIAtom* aList, nsIFrame* aStart, nsIFrame* aNext);
|
||||
static void GetAccessible(nsIFrame* aFrame, nsCOMPtr<nsIAccessible>& aAccessible, nsCOMPtr<nsIContent>& aContent);
|
||||
|
||||
nsCOMPtr<nsIPresContext> mPresContext;
|
||||
nsCOMPtr<nsIAccessible> mAccessible;
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
nsAccessible* mOwner;
|
||||
};
|
||||
|
||||
nsFrameTreeWalker::nsFrameTreeWalker(nsIPresContext* aPresContext, nsAccessible* aOwner)
|
||||
{
|
||||
mPresContext = aPresContext;
|
||||
mOwner = aOwner;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetParent(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get parent\n");
|
||||
|
||||
nsIFrame* parent = nsnull;
|
||||
aFrame->GetParent(&parent);
|
||||
|
||||
// if no parent then we hit the root
|
||||
// just return that top frame
|
||||
if (!parent) {
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return aFrame;
|
||||
}
|
||||
|
||||
GetAccessible(parent, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
return parent;
|
||||
|
||||
return GetParent(parent);
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetNextSibling(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get next\n");
|
||||
|
||||
// get next sibling
|
||||
nsIFrame* next = nsnull;
|
||||
aFrame->GetNextSibling(&next);
|
||||
nsIAtom* list = nsnull;
|
||||
mOwner->GetListAtomForFrame(aFrame, list);
|
||||
|
||||
|
||||
// skip any frames with the same content node
|
||||
while(ShouldSkip(mPresContext, list, aFrame, next))
|
||||
next->GetNextSibling(&next);
|
||||
|
||||
|
||||
// if failed
|
||||
if (!next)
|
||||
{
|
||||
// if parent has content
|
||||
nsIFrame* parent = nsnull;
|
||||
aFrame->GetParent(&parent);
|
||||
|
||||
// if no parent fail
|
||||
if (!parent) {
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// fail if we reach a parent that is accessible
|
||||
GetAccessible(parent, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
{
|
||||
// fail
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
} else {
|
||||
// next on parent
|
||||
nsIFrame* n = GetNextSibling(parent);
|
||||
if (ShouldSkip(mPresContext, list, aFrame, n))
|
||||
return GetNextSibling(n);
|
||||
else
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
// if next has content
|
||||
GetAccessible(next, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
{
|
||||
// done
|
||||
return next;
|
||||
}
|
||||
|
||||
// if next doesn't have node
|
||||
|
||||
// call first on next
|
||||
nsIFrame* first = GetFirstChild(next);
|
||||
|
||||
// if found
|
||||
if (first) {
|
||||
if (ShouldSkip(mPresContext, list, aFrame, first))
|
||||
return GetNextSibling(first);
|
||||
else
|
||||
return first;
|
||||
}
|
||||
|
||||
// call next on next
|
||||
nsIFrame* n = GetNextSibling(next);
|
||||
if (ShouldSkip(mPresContext, list, aFrame, next))
|
||||
return GetNextSibling(n);
|
||||
else
|
||||
return n;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetFirstChild(nsIFrame* aFrame)
|
||||
{
|
||||
|
||||
//printf("Get first\n");
|
||||
|
||||
// get first child
|
||||
nsIFrame* child = nsnull;
|
||||
nsIAtom* list = nsnull;
|
||||
mOwner->GetListAtomForFrame(aFrame, list);
|
||||
aFrame->FirstChild(mPresContext, list, &child);
|
||||
|
||||
while(child)
|
||||
{
|
||||
// if first has a content node
|
||||
GetAccessible(child, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
{
|
||||
// done
|
||||
return child;
|
||||
} else {
|
||||
// call first on child
|
||||
nsIFrame* first = GetFirstChild(child);
|
||||
|
||||
// if succeeded
|
||||
if (first)
|
||||
{
|
||||
// return child
|
||||
return first;
|
||||
}
|
||||
}
|
||||
|
||||
// get next sibling
|
||||
nsIFrame* next;
|
||||
child->GetNextSibling(&next);
|
||||
|
||||
// skip children with duplicate content nodes
|
||||
nsIAtom* list = nsnull;
|
||||
mOwner->GetListAtomForFrame(child, list);
|
||||
|
||||
while(ShouldSkip(mPresContext, list, child, next))
|
||||
next->GetNextSibling(&next);
|
||||
|
||||
child = next;
|
||||
}
|
||||
|
||||
// fail
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetChildBefore(nsIFrame* aParent, nsIFrame* aChild)
|
||||
{
|
||||
nsIFrame* child = GetFirstChild(aParent);
|
||||
|
||||
// if the child is not us
|
||||
if (child == aChild) {
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame* prev = child;
|
||||
nsCOMPtr<nsIContent> prevContent = mContent;
|
||||
nsCOMPtr<nsIAccessible> prevAccessible = mAccessible;
|
||||
|
||||
while(child)
|
||||
{
|
||||
child = GetNextSibling(child);
|
||||
|
||||
if (child == aChild)
|
||||
break;
|
||||
|
||||
prev = child;
|
||||
prevContent = mContent;
|
||||
prevAccessible = mAccessible;
|
||||
}
|
||||
|
||||
mAccessible = prevAccessible;
|
||||
mContent = prevContent;
|
||||
return prev;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetPreviousSibling(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get previous\n");
|
||||
|
||||
nsIFrame* parent = GetParent(aFrame);
|
||||
|
||||
return GetChildBefore(parent, aFrame);
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetLastChild(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get last\n");
|
||||
|
||||
return GetChildBefore(aFrame, nsnull);
|
||||
}
|
||||
|
||||
PRInt32 nsFrameTreeWalker::GetCount(nsIFrame* aFrame)
|
||||
{
|
||||
|
||||
//printf("Get count\n");
|
||||
nsIFrame* child = GetFirstChild(aFrame);
|
||||
|
||||
PRInt32 count = 0;
|
||||
while(child)
|
||||
{
|
||||
count++;
|
||||
child = GetNextSibling(child);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void nsFrameTreeWalker::GetAccessible(nsIFrame* aFrame, nsCOMPtr<nsIAccessible>& aAccessible, nsCOMPtr<nsIContent>& aContent)
|
||||
{
|
||||
aContent = nsnull;
|
||||
aAccessible = nsnull;
|
||||
|
||||
aFrame->GetContent(getter_AddRefs(aContent));
|
||||
|
||||
if (!aContent)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
if (!document)
|
||||
return;
|
||||
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
nsIPresShell* shell = document->GetShellAt(0);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(aContent, &frame);
|
||||
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
aAccessible = do_QueryInterface(aFrame);
|
||||
|
||||
if (!aAccessible)
|
||||
aAccessible = do_QueryInterface(aContent);
|
||||
|
||||
// if (aAccessible)
|
||||
// printf("Found accessible!\n");
|
||||
}
|
||||
|
||||
PRBool nsFrameTreeWalker::ShouldSkip(nsIPresContext* aContext, nsIAtom* aList, nsIFrame* aStart, nsIFrame* aNext)
|
||||
{
|
||||
if (!aStart || !aNext)
|
||||
return PR_FALSE;
|
||||
|
||||
// is content the same? If so skip it
|
||||
nsCOMPtr<nsIContent> content1;
|
||||
nsCOMPtr<nsIContent> content2;
|
||||
|
||||
aStart->GetContent(getter_AddRefs(content1));
|
||||
aNext->GetContent(getter_AddRefs(content2));
|
||||
|
||||
if (content1 == content2 && content1 != nsnull) {
|
||||
// does it have childen? It it does then don't skip it
|
||||
nsIFrame* child = nsnull;
|
||||
aNext->FirstChild(aContext, aList, &child);
|
||||
if (child)
|
||||
return PR_FALSE;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class nsAccessible
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsAccessible::nsAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
// get frame and node
|
||||
mContent = aContent;
|
||||
mAccessible = aAccessible;
|
||||
mPresShell = aShell;
|
||||
|
||||
#ifdef DEBUG_LEAKS
|
||||
printf("nsAccessibles=%d\n", ++gnsAccessibles);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsAccessible::~nsAccessible()
|
||||
{
|
||||
#ifdef DEBUG_LEAKS
|
||||
printf("nsAccessibles=%d\n", --gnsAccessibles);
|
||||
#endif
|
||||
}
|
||||
|
||||
//NS_IMPL_ISUPPORTS2(nsAccessible, nsIAccessible, nsIAccessibleWidgetAccess);
|
||||
NS_IMPL_ISUPPORTS1(nsAccessible, nsIAccessible);
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccParent(aAccParent);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
walker.GetParent(GetFrame());
|
||||
|
||||
// if no content or accessible then we hit the root
|
||||
if (!walker.mContent || !walker.mAccessible)
|
||||
{
|
||||
*aAccParent = new nsRootAccessible(mPresShell);
|
||||
NS_ADDREF(*aAccParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aAccParent = CreateNewParentAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aAccParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
/* readonly attribute nsIAccessible accNextSibling; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccNextSibling(nsIAccessible * *aAccNextSibling)
|
||||
{
|
||||
// delegate
|
||||
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccNextSibling(aAccNextSibling);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
|
||||
nsIFrame* next = walker.GetNextSibling(GetFrame());
|
||||
|
||||
if (next && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccNextSibling = CreateNewNextAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccNextSibling);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccNextSibling = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accPreviousSibling; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccPreviousSibling(nsIAccessible * *aAccPreviousSibling)
|
||||
{
|
||||
// delegate
|
||||
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccPreviousSibling(aAccPreviousSibling);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
nsIFrame* prev = walker.GetPreviousSibling(GetFrame());
|
||||
|
||||
if (prev && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccPreviousSibling = CreateNewPreviousAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccPreviousSibling);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccPreviousSibling = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accFirstChild; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccFirstChild(nsIAccessible * *aAccFirstChild)
|
||||
{
|
||||
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccFirstChild(aAccFirstChild);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
nsIFrame* child = walker.GetFirstChild(GetFrame());
|
||||
|
||||
if (child && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccFirstChild = CreateNewFirstAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccFirstChild);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccFirstChild = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accFirstChild; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccLastChild(nsIAccessible * *aAccLastChild)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccLastChild(aAccLastChild);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
nsIFrame* last = walker.GetLastChild(GetFrame());
|
||||
|
||||
if (last && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccLastChild = CreateNewLastAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccLastChild);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccLastChild = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute long accChildCount; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccChildCount(PRInt32 *aAccChildCount)
|
||||
{
|
||||
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccChildCount(aAccChildCount);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
*aAccChildCount = walker.GetCount(GetFrame());
|
||||
} else
|
||||
*aAccChildCount = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccName(PRUnichar * *aAccName)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccName(aAccName);
|
||||
if (NS_SUCCEEDED(rv) && *aAccName != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aAccName = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccDefaultAction(PRUnichar * *aDefaultAction)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccDefaultAction(aDefaultAction);
|
||||
if (NS_SUCCEEDED(rv) && *aDefaultAction != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aDefaultAction = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::SetAccName(const PRUnichar * aAccName)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->SetAccName(aAccName);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute wstring accValue; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccValue(PRUnichar * *aAccValue)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccValue(aAccValue);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && *aAccValue != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aAccValue = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::SetAccValue(const PRUnichar * aAccValue) { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
/* readonly attribute wstring accDescription; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccDescription(PRUnichar * *aAccDescription)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccDescription(aAccDescription);
|
||||
if (NS_SUCCEEDED(rv) && *aAccDescription != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accRole; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccRole(PRUnichar * *aAccRole)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccRole(aAccRole);
|
||||
if (NS_SUCCEEDED(rv) && *aAccRole != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accState; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible)
|
||||
return mAccessible->GetAccState(aAccState);
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetAccExtState(PRUint32 *aAccExtState)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible)
|
||||
return mAccessible->GetAccExtState(aAccExtState);
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accHelp; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccHelp(PRUnichar * *aAccHelp)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccHelp(aAccHelp);
|
||||
if (NS_SUCCEEDED(rv) && *aAccHelp != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute boolean accFocused; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccFocused(PRBool *aAccFocused) { return NS_OK; }
|
||||
|
||||
/* nsIAccessible accGetChildAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsAccessible::AccGetAt(PRInt32 tx, PRInt32 ty, nsIAccessible **_retval)
|
||||
{
|
||||
PRInt32 x,y,w,h;
|
||||
AccGetBounds(&x,&y,&w,&h);
|
||||
if (tx > x && tx < x + w && ty > y && ty < y + h)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
GetAccFirstChild(getter_AddRefs(child));
|
||||
PRInt32 cx,cy,cw,ch;
|
||||
|
||||
while(child) {
|
||||
child->AccGetBounds(&cx,&cy,&cw,&ch);
|
||||
|
||||
if (tx > cx && tx < cx + cw && ty > cy && ty < cy + ch)
|
||||
{
|
||||
*_retval = child;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
child->GetAccNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
}
|
||||
|
||||
|
||||
*_retval = this;
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void accNavigateRight (); */
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateRight(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
/* void navigateLeft (); */
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateLeft(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
/* void navigateUp (); */
|
||||
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateUp(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
/* void navigateDown (); */
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateDown(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
|
||||
/* void addSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccAddSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccAddSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void removeSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccRemoveSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccRemoveSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void extendSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccExtendSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccExtendSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void takeSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccTakeSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccTakeSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void takeFocus (); */
|
||||
NS_IMETHODIMP nsAccessible::AccTakeFocus(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccTakeFocus();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void doDefaultAction (); */
|
||||
NS_IMETHODIMP nsAccessible::AccDoDefaultAction(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccDoDefaultAction();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
nsIFrame* frame = GetBoundsFrame();
|
||||
|
||||
if (!frame || !context)
|
||||
{
|
||||
*x = *y = *width = *height = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// sum up all rects of frames with the same content node
|
||||
nsRect r;
|
||||
nsIFrame* start = frame;
|
||||
nsIFrame* next = nsnull;
|
||||
start->GetNextSibling(&next);
|
||||
|
||||
start->GetRect(r);
|
||||
|
||||
while (nsFrameTreeWalker::ShouldSkip(context,nsnull, start, next))
|
||||
{
|
||||
nsRect r2;
|
||||
next->GetRect(r2);
|
||||
r.UnionRect(r,r2);
|
||||
next->GetNextSibling(&next);
|
||||
}
|
||||
|
||||
nsPoint offset(r.x,r.y);
|
||||
|
||||
frame->GetParent(&frame);
|
||||
|
||||
nsPoint pos(0,0);
|
||||
while(frame) {
|
||||
nsIScrollableView* scrollingView;
|
||||
nsIView* view;
|
||||
// XXX hack
|
||||
frame->GetView(context, &view);
|
||||
if (view) {
|
||||
nsresult result = view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollingView);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nscoord xoff = 0;
|
||||
nscoord yoff = 0;
|
||||
scrollingView->GetScrollPosition(xoff, yoff);
|
||||
offset.x -= xoff;
|
||||
offset.y -= yoff;
|
||||
}
|
||||
}
|
||||
|
||||
frame->GetOrigin(pos);
|
||||
offset += pos;
|
||||
frame->GetParent(&frame);
|
||||
}
|
||||
|
||||
float t2p;
|
||||
context->GetTwipsToPixels(&t2p);
|
||||
|
||||
*x = (PRInt32)(offset.x*t2p);
|
||||
*y = (PRInt32)(offset.y*t2p);
|
||||
*width = (PRInt32)(r.width*t2p);
|
||||
*height = (PRInt32)(r.height*t2p);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// helpers
|
||||
|
||||
nsIFrame* nsAccessible::GetBoundsFrame()
|
||||
{
|
||||
return GetFrame();
|
||||
}
|
||||
|
||||
nsIFrame* nsAccessible::GetFrame()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mContent, &frame);
|
||||
return frame;
|
||||
}
|
||||
|
||||
void nsAccessible::GetPresContext(nsCOMPtr<nsIPresContext>& aContext)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
|
||||
if (shell) {
|
||||
shell->GetPresContext(getter_AddRefs(aContext));
|
||||
} else
|
||||
aContext = nsnull;
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewParentAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
|
||||
// ------- nsHTMLBlockAccessible ------
|
||||
|
||||
nsHTMLBlockAccessible::nsHTMLBlockAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell):nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
nsIAccessible* nsHTMLBlockAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsHTMLBlockAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
/* nsIAccessible accGetAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsHTMLBlockAccessible::AccGetAt(PRInt32 tx, PRInt32 ty, nsIAccessible **_retval)
|
||||
{
|
||||
PRInt32 x,y,w,h;
|
||||
AccGetBounds(&x,&y,&w,&h);
|
||||
if (tx > x && tx < x + w && ty > y && ty < y + h)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
nsCOMPtr<nsIAccessible> smallestChild;
|
||||
PRInt32 smallestArea = -1;
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
GetAccFirstChild(getter_AddRefs(child));
|
||||
PRInt32 cx,cy,cw,ch;
|
||||
|
||||
while(child) {
|
||||
child->AccGetBounds(&cx,&cy,&cw,&ch);
|
||||
|
||||
// ok if there are multiple frames the contain the point
|
||||
// and they overlap then pick the smallest. We need to do this
|
||||
// for text frames.
|
||||
if (tx > cx && tx < cx + cw && ty > cy && ty < cy + ch)
|
||||
{
|
||||
if (smallestArea == -1 || cw*ch < smallestArea) {
|
||||
smallestArea = cw*ch;
|
||||
smallestChild = child;
|
||||
}
|
||||
}
|
||||
child->GetAccNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
}
|
||||
|
||||
if (smallestChild != nsnull)
|
||||
{
|
||||
*_retval = smallestChild;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = this;
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsAccessible_H_
|
||||
#define _nsAccessible_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
class nsIFrame;
|
||||
|
||||
class nsAccessible : public nsIAccessible
|
||||
// public nsIAccessibleWidgetAccess
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAccessibilityService methods:
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
|
||||
//NS_IMETHOD AccGetWidget(nsIWidget**);
|
||||
|
||||
public:
|
||||
nsAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessible();
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList) { aList = nsnull; }
|
||||
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
|
||||
virtual nsIAccessible* CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewParentAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIAccessible> mAccessible;
|
||||
};
|
||||
|
||||
/* Special Accessible that knows how to handle hit detection for flowing text */
|
||||
class nsHTMLBlockAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLBlockAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
protected:
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aFrame, nsIWeakReference* aShell);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,335 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWeakReference.h"
|
||||
|
||||
/* Implementation file */
|
||||
NS_IMPL_ISUPPORTS1(nsGenericAccessible, nsIAccessible)
|
||||
|
||||
nsGenericAccessible::nsGenericAccessible()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsGenericAccessible::~nsGenericAccessible()
|
||||
{
|
||||
/* destructor code */
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccParent (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccName (in wstring name); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccName(const PRUnichar *name)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccValue (in wstring value); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccValue(const PRUnichar *value)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDescription(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccHelp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccHelp(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* boolean getAccFocused (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFocused(PRBool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accGetAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateRight (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateRight(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateLeft (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateLeft(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateUp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateUp(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateDown (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateDown(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accAddSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccAddSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accRemoveSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccRemoveSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accExtendSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccExtendSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeFocus (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeFocus()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accDoDefaultAction (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccDoDefaultAction()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* unsigned long getAccExtState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//-------------
|
||||
// nsDOMAccessible
|
||||
//-------------
|
||||
|
||||
nsDOMAccessible::nsDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode)
|
||||
{
|
||||
mPresShell = getter_AddRefs(NS_GetWeakReference(aShell));
|
||||
mNode = aNode;
|
||||
}
|
||||
|
||||
|
||||
/* void accRemoveSelection (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccRemoveSelection()
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> control = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult rv = control->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
rv = mNode->GetParentNode(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = selection->Collapse(parent, 0);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void accTakeSelection (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccTakeSelection()
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> control = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult rv = control->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
rv = mNode->GetParentNode(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PRInt32 offsetInParent = 0;
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
rv = parent->GetFirstChild(getter_AddRefs(child));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> next;
|
||||
|
||||
while(child)
|
||||
{
|
||||
if (child == mNode) {
|
||||
// Collapse selection to just before desired element,
|
||||
rv = selection->Collapse(parent, offsetInParent);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// then extend it to just after
|
||||
rv = selection->Extend(parent, offsetInParent+1);
|
||||
return rv;
|
||||
}
|
||||
|
||||
child->GetNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
offsetInParent++;
|
||||
}
|
||||
|
||||
// didn't find a child
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void accTakeFocus (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccTakeFocus()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mNode);
|
||||
content->SetFocus(context);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------
|
||||
// nsLeafFrameAccessible
|
||||
//-------------
|
||||
|
||||
nsLeafDOMAccessible::nsLeafDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsDOMAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsGenericAccessible_H_
|
||||
#define _nsGenericAccessible_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
|
||||
/**
|
||||
* Basic implementation
|
||||
* supports nothing
|
||||
*/
|
||||
class nsGenericAccessible : public nsIAccessible
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
|
||||
public:
|
||||
nsGenericAccessible();
|
||||
virtual ~nsGenericAccessible();
|
||||
};
|
||||
|
||||
/**
|
||||
* And accessible that observes a dom node
|
||||
* supports:
|
||||
* - selection
|
||||
* - focus
|
||||
*/
|
||||
class nsDOMAccessible : public nsGenericAccessible
|
||||
{
|
||||
public:
|
||||
nsDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
|
||||
NS_IMETHOD AccTakeSelection(void);
|
||||
NS_IMETHOD AccTakeFocus(void);
|
||||
NS_IMETHOD AccRemoveSelection(void);
|
||||
|
||||
protected:
|
||||
nsIWeakReference* mPresShell;
|
||||
nsCOMPtr<nsIDOMNode> mNode;
|
||||
};
|
||||
|
||||
/* Leaf version of DOM Accessible
|
||||
* has no children
|
||||
*/
|
||||
class nsLeafDOMAccessible : public nsDOMAccessible
|
||||
{
|
||||
public:
|
||||
nsLeafDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,175 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
nsHTMLFormControlAccessible::nsHTMLFormControlAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsLeafDOMAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
// go up tree get name of label if there is one.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, checked
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
*_retval = (checked ? STATE_CHECKED : 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --- checkbox -----
|
||||
|
||||
nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("check box"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
// check or uncheck
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
if (checked)
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Check"));
|
||||
else
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("UnCheck"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void accDoDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoDefaultAction()
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
element->SetChecked(checked ? PR_FALSE : PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//------ Radio button -------
|
||||
|
||||
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Select"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("radio button"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::AccDoDefaultAction()
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
element->Click();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ----- Button -----
|
||||
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Press"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("push button"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> button = do_QueryInterface(mNode);
|
||||
|
||||
if (!button)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString name;
|
||||
button->GetValue(name);
|
||||
name.CompressWhitespace();
|
||||
|
||||
*_retval = name.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::AccDoDefaultAction()
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
element->Click();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLFormControlAccessible_H_
|
||||
#define _nsHTMLFormControlAccessible_H_
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
|
||||
class nsICheckboxControlFrame;
|
||||
|
||||
/* Accessible for supporting for controls
|
||||
* supports:
|
||||
* - walking up to get name from label
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLFormControlAccessible : public nsLeafDOMAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLFormControlAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsHTMLCheckboxAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLCheckboxAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
};
|
||||
|
||||
class nsHTMLRadioButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLRadioButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
};
|
||||
|
||||
class nsHTMLButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsICheckboxControlFrame.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIPresShell* aShell, nsIDOMNode* aDomNode):
|
||||
nsLeafDOMAccessible(aShell, aDomNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
nsAutoString value;
|
||||
mNode->GetNodeValue(value);
|
||||
value.CompressWhitespace();
|
||||
*_retval = value.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
nsAutoString role(NS_LITERAL_STRING("text"));
|
||||
*_retval = role.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLTextAccessible_H_
|
||||
#define _nsHTMLTextAccessible_H_
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
class nsITextControlFrame;
|
||||
|
||||
class nsHTMLTextAccessible : public nsLeafDOMAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLTextAccessible(nsIPresShell* aShell, nsIDOMNode* aDomNode);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIDOMNode> mDomNode;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,263 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsMutableAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMutableAccessible, nsIAccessible)
|
||||
|
||||
nsMutableAccessible::nsMutableAccessible(nsISupports* aNode)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
NS_ASSERTION(aNode,"We must have a valid node!!");
|
||||
mNode = aNode;
|
||||
mNameNodeValue = PR_FALSE;
|
||||
mNameStringSet = PR_FALSE;
|
||||
mRole = NS_LITERAL_STRING("unknown");
|
||||
mIsLeaf = PR_FALSE;
|
||||
}
|
||||
|
||||
nsMutableAccessible::~nsMutableAccessible()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::SetIsLeaf(PRBool aLeaf)
|
||||
{
|
||||
mIsLeaf = aLeaf;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void SetNodeAsNodeValue (); */
|
||||
NS_IMETHODIMP nsMutableAccessible::SetNameAsNodeValue()
|
||||
{
|
||||
mNameNodeValue = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void SetName (in wstring name); */
|
||||
NS_IMETHODIMP nsMutableAccessible::SetName(const PRUnichar *aName)
|
||||
{
|
||||
mName = aName;
|
||||
mNameStringSet = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void SetNameAsAttribute (in nsIAtom atom); */
|
||||
NS_IMETHODIMP nsMutableAccessible::SetNameAsAttribute(nsIAtom *aAttribute)
|
||||
{
|
||||
mNameAttribute = aAttribute;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void SetNameAsAttribute (in nsIAtom atom); */
|
||||
NS_IMETHODIMP nsMutableAccessible::SetRole(const PRUnichar *aRole)
|
||||
{
|
||||
mRole = aRole;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
if (mIsLeaf) {
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
if (mIsLeaf) {
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
if (mIsLeaf) {
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
nsAutoString value;
|
||||
|
||||
if (mNameNodeValue) {
|
||||
// see if we can get nodevalue
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mNode);
|
||||
if (node) {
|
||||
node->GetNodeValue(value);
|
||||
value.CompressWhitespace();
|
||||
} else {
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
} else if (mNameStringSet) {
|
||||
value = mName;
|
||||
} else if (mNameAttribute) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mNode);
|
||||
content->GetAttribute(kNameSpaceID_None, mNameAttribute, value);
|
||||
value.CompressWhitespace();
|
||||
} else {
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
*_retval = value.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::SetAccName(const PRUnichar *name)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::SetAccValue(const PRUnichar *value)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccDescription(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = mRole.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccHelp(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccFocused(PRBool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccNavigateRight(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccNavigateLeft(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccNavigateUp(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccNavigateDown(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccAddSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccRemoveSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccExtendSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccTakeSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccTakeFocus()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccDoDefaultAction()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsMutableAccessible_H_
|
||||
#define _nsMutableAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIMutableAccessible.h"
|
||||
|
||||
class nsMutableAccessible : public nsIMutableAccessible
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
NS_DECL_NSIMUTABLEACCESSIBLE
|
||||
|
||||
nsMutableAccessible(nsISupports* aNode);
|
||||
virtual ~nsMutableAccessible();
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsISupports> mNode;
|
||||
nsAutoString mName;
|
||||
nsAutoString mRole;
|
||||
nsCOMPtr<nsIAtom> mNameAttribute;
|
||||
PRPackedBool mNameNodeValue;
|
||||
PRPackedBool mNameStringSet;
|
||||
PRPackedBool mIsLeaf;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,199 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsRootAccessible)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessibleEventReceiver)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleEventReceiver)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsAccessible)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsRootAccessible, nsAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsAccessible);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell, nsIFrame* aFrame):nsAccessible(nsnull,nsnull,aShell)
|
||||
{
|
||||
// mFrame = aFrame;
|
||||
mListener = nsnull;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::~nsRootAccessible()
|
||||
{
|
||||
RemoveAccessibleEventListener(mListener);
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccName(PRUnichar * *aAccName)
|
||||
{
|
||||
*aAccName = ToNewUnicode(NS_LITERAL_STRING("Mozilla Document"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// helpers
|
||||
nsIFrame* nsRootAccessible::GetFrame()
|
||||
{
|
||||
//if (!mFrame) {
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* root = nsnull;
|
||||
if (shell)
|
||||
shell->GetRootFrame(&root);
|
||||
|
||||
return root;
|
||||
//}
|
||||
|
||||
// return mFrame;
|
||||
}
|
||||
|
||||
nsIAccessible* nsRootAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return new nsHTMLBlockAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
*aAccParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accRole; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccRole(PRUnichar * *aAccRole)
|
||||
{
|
||||
*aAccRole = ToNewUnicode(NS_LITERAL_STRING("client"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void addAccessibleEventListener (in nsIAccessibleEventListener aListener); */
|
||||
NS_IMETHODIMP nsRootAccessible::AddAccessibleEventListener(nsIAccessibleEventListener *aListener)
|
||||
{
|
||||
if (!mListener)
|
||||
{
|
||||
// add an event listener to the document
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
shell->GetDocument(getter_AddRefs(document));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> receiver;
|
||||
if (NS_SUCCEEDED(document->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(receiver))) && receiver)
|
||||
{
|
||||
nsresult rv = receiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener *, this), NS_GET_IID(nsIDOMFocusListener));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
}
|
||||
}
|
||||
|
||||
// create a weak reference to the listener
|
||||
mListener = aListener;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void removeAccessibleEventListener (in nsIAccessibleEventListener aListener); */
|
||||
NS_IMETHODIMP nsRootAccessible::RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener)
|
||||
{
|
||||
if (mListener)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
if (!shell)
|
||||
return NS_OK;
|
||||
|
||||
shell->GetDocument(getter_AddRefs(document));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> erP;
|
||||
if (NS_SUCCEEDED(document->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP))) && erP)
|
||||
{
|
||||
nsresult rv = erP->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener *, this), NS_GET_IID(nsIDOMFocusListener));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
}
|
||||
}
|
||||
|
||||
mListener = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (mListener) {
|
||||
nsCOMPtr<nsIDOMEventTarget> t;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(t));
|
||||
|
||||
// create and accessible for the target
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(t);
|
||||
|
||||
if (!content)
|
||||
return NS_OK;
|
||||
|
||||
if (mCurrentFocus == content)
|
||||
return NS_OK;
|
||||
|
||||
mCurrentFocus = content;
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
if (!frame)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAccessible> a = do_QueryInterface(frame);
|
||||
|
||||
if (!a)
|
||||
a = do_QueryInterface(content);
|
||||
|
||||
nsCOMPtr<nsIAccessible> na = CreateNewAccessible(a, content, mPresShell);
|
||||
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, na);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsRootAccessible::Focus(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsRootAccessible::Blur(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsRootAccessible_H_
|
||||
#define _nsRootAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleEventReceiver.h"
|
||||
#include "nsIAccessibleEventListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
|
||||
class nsRootAccessible : public nsAccessible,
|
||||
public nsIAccessibleEventReceiver,
|
||||
public nsIDOMFocusListener
|
||||
|
||||
{
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public:
|
||||
nsRootAccessible(nsIWeakReference* aShell, nsIFrame* aFrame = nsnull);
|
||||
virtual ~nsRootAccessible();
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHOD GetAccName(PRUnichar * *aAccName);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccRole(PRUnichar * *aAccRole);
|
||||
|
||||
// ----- nsIAccessibleEventReceiver ------
|
||||
|
||||
NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
NS_IMETHOD RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
|
||||
// ----- nsIDOMEventListener --------
|
||||
virtual nsresult HandleEvent(nsIDOMEvent* anEvent);
|
||||
virtual nsresult Focus(nsIDOMEvent* aEvent);
|
||||
virtual nsresult Blur(nsIDOMEvent* aEvent);
|
||||
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
// not a com pointer. We don't own the listener
|
||||
// it is the callers responsibility to remove the listener
|
||||
// otherwise we will get into circular referencing problems
|
||||
nsIAccessibleEventListener* mListener;
|
||||
nsCOMPtr<nsIContent> mCurrentFocus;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,717 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsSelectAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsMutableAccessible.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIDOMMenuListener.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
class nsSelectChildAccessible : public nsAccessible,
|
||||
public nsIDOMMenuListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsSelectChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectChildAccessible();
|
||||
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccValue(PRUnichar **_retval);
|
||||
|
||||
virtual nsIAccessible* CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
// popup listener
|
||||
NS_IMETHOD Create(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Destroy(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
nsCOMPtr<nsIContent> mSelectContent;
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsSelectChildAccessible, nsAccessible, nsIDOMMenuListener)
|
||||
|
||||
class nsSelectWindowAccessible : public nsAccessible,
|
||||
public nsIDOMMenuListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsSelectWindowAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aPrev, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectWindowAccessible();
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccExtState(PRUint32 *_retval);
|
||||
|
||||
// popup listener
|
||||
NS_IMETHOD Create(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Destroy(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
// helpers
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
nsCOMPtr<nsIAccessible> mPrev;
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsSelectWindowAccessible, nsAccessible, nsIDOMMenuListener)
|
||||
|
||||
class nsSelectListAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsSelectListAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectListAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList);
|
||||
virtual nsIAccessible* CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
class nsListChildAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsListChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsListChildAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList);
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
nsCOMPtr<nsIContent> mSelectContent;
|
||||
};
|
||||
|
||||
//---------
|
||||
|
||||
nsSelectAccessible::nsSelectAccessible(nsIAtom* aPopupAtom,
|
||||
nsIAccessible* aAccessible,
|
||||
nsIContent* aContent,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mPopupAtom = aPopupAtom;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
// our value is our first child's value. Which is the combo boxes text.
|
||||
nsCOMPtr<nsIAccessible> text;
|
||||
nsresult rv = GetAccFirstChild(getter_AddRefs(text));
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!text) {
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// look at our role
|
||||
return text->GetAccValue(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("combo box"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
// get the last child. Wrap it with a connector that connects it to the window accessible
|
||||
nsCOMPtr<nsIAccessible> last;
|
||||
nsresult rv = nsAccessible::GetAccLastChild(getter_AddRefs(last));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!last) {
|
||||
// we have a parent but not previous
|
||||
*_retval = new nsSelectWindowAccessible(mPopupAtom, this, nsnull, nsnull, mContent, mPresShell);
|
||||
} else {
|
||||
*_retval = last;
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
// get the last child. Wrap it with a connector that connects it to the window accessible
|
||||
nsCOMPtr<nsIAccessible> first;
|
||||
nsresult rv = nsAccessible::GetAccFirstChild(getter_AddRefs(first));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!first) {
|
||||
*_retval = new nsSelectWindowAccessible(mPopupAtom, this, nsnull, nsnull, mContent, mPresShell);
|
||||
} else {
|
||||
*_retval = first;
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectAccessible::CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewLastAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectAccessible::CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsSelectChildAccessible(mPopupAtom, mContent, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
nsresult rv = nsAccessible::GetAccChildCount(_retval);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// always have one more that is our window child
|
||||
(*_retval)++;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
|
||||
nsSelectChildAccessible::nsSelectChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell):
|
||||
nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mPopupAtom = aPopupAtom;
|
||||
mSelectContent = aSelectContent;
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar* string = nsnull;
|
||||
|
||||
// look at our role
|
||||
rv = nsAccessible::GetAccRole(&string);
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoString role(string);
|
||||
|
||||
// if its the text in the combo box then
|
||||
// its value should be its name.
|
||||
if (role.EqualsIgnoreCase("text")) {
|
||||
rv = nsAccessible::GetAccName(_retval);
|
||||
} else {
|
||||
rv = nsAccessible::GetAccValue(_retval);
|
||||
}
|
||||
|
||||
delete string;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar* string = nsnull;
|
||||
|
||||
// look at our role
|
||||
rv = nsAccessible::GetAccRole(&string);
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoString role(string);
|
||||
|
||||
// any text in the combo box is static
|
||||
if (role.EqualsIgnoreCase("text")) {
|
||||
// if it the comboboxes text. Make it static
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("static text"));
|
||||
} else {
|
||||
rv = nsAccessible::GetAccRole(_retval);
|
||||
}
|
||||
|
||||
delete string;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar* string = nsnull;
|
||||
|
||||
// look at our role
|
||||
nsAccessible::GetAccRole(&string);
|
||||
nsAutoString role(string);
|
||||
|
||||
// if button then we need to make the name be open or close
|
||||
if (role.EqualsIgnoreCase("push button"))
|
||||
{
|
||||
// if its a button and not already registered,
|
||||
// register ourselves as a popup listener
|
||||
if (!mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mSelectContent);
|
||||
if (!eventReceiver) {
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
eventReceiver->AddEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
|
||||
// get the current state open or closed
|
||||
// set _retval to it.
|
||||
// notice its supposed to be reversed. Close if opened
|
||||
// and Open if closed.
|
||||
|
||||
if (mOpen)
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Close"));
|
||||
else
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Open"));
|
||||
|
||||
} else {
|
||||
/*rv = nsAccessible::GetAccName(_retval);*/
|
||||
rv = NS_ERROR_NOT_IMPLEMENTED;
|
||||
*_retval = nsnull;
|
||||
}
|
||||
|
||||
delete string;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsSelectChildAccessible::~nsSelectChildAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mSelectContent);
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::Create(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
printf("Open\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::Destroy(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectChildAccessible::CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewPreviousAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectChildAccessible::CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsSelectChildAccessible(mPopupAtom, mSelectContent, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
nsresult rv = nsAccessible::GetAccNextSibling(getter_AddRefs(next));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!next) {
|
||||
// ok no more siblings. Lets create our window
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsSelectWindowAccessible(mPopupAtom, parent, nsnull, nsnull, mSelectContent, mPresShell);
|
||||
} else {
|
||||
*_retval = next;
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//---------------------
|
||||
|
||||
|
||||
nsSelectWindowAccessible::nsSelectWindowAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aPrev, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
:nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
mPrev = aPrev;
|
||||
mPopupAtom = aPopupAtom;
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
nsSelectWindowAccessible::~nsSelectWindowAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mContent);
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::Create(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
printf("Open\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::Destroy(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// not not already one register ourselves as a popup listener
|
||||
|
||||
if (!mRegistered) {
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mContent);
|
||||
if (!eventReceiver) {
|
||||
*_retval = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = 0;
|
||||
return rv;
|
||||
}
|
||||
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
|
||||
// if open we are visible if closed we are invisible
|
||||
// set _retval to it.
|
||||
if (mOpen)
|
||||
*_retval |= STATE_DEFAULT;
|
||||
else
|
||||
*_retval |= STATE_INVISIBLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
*_retval=0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("window"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mPrev;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsSelectListAccessible(mPopupAtom, this, nsnull, mContent, mPresShell);
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsSelectListAccessible(mPopupAtom, this, nsnull, mContent, mPresShell);
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
*x = *y = *width = *height = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
*/
|
||||
|
||||
nsIFrame* nsSelectWindowAccessible::GetBoundsFrame()
|
||||
{
|
||||
// get our frame
|
||||
nsIFrame* frame = GetFrame();
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
// get its first popup child that should be the window
|
||||
frame->FirstChild(context, mPopupAtom, &frame);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
//----------
|
||||
|
||||
|
||||
nsSelectListAccessible::nsSelectListAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
:nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mPopupAtom = aPopupAtom;
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
void nsSelectListAccessible::GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mContent, &frame);
|
||||
if (aFrame == frame)
|
||||
aList = mPopupAtom;
|
||||
else
|
||||
aList = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return mParent->AccGetBounds(x,y,width,height);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("list"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectListAccessible::CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsListChildAccessible(mPopupAtom, mContent, this, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectListAccessible::CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsListChildAccessible(mPopupAtom, mContent, this, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
//--------
|
||||
|
||||
nsListChildAccessible::nsListChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell):
|
||||
nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
mPopupAtom = aPopupAtom;
|
||||
mSelectContent = aSelectContent;
|
||||
}
|
||||
|
||||
nsIAccessible* nsListChildAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsListChildAccessible(mPopupAtom, mSelectContent, mParent, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
void nsListChildAccessible::GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mSelectContent, &frame);
|
||||
if (aFrame == frame)
|
||||
aList = mPopupAtom;
|
||||
else
|
||||
aList = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsListChildAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("list item"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsListChildAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsSelectAccessible_h__
|
||||
#define __nsSelectAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsSelectAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsSelectAccessible(nsIAtom* aPopupAtom, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccValue(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
virtual ~nsSelectAccessible() {}
|
||||
virtual nsIAccessible* CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,33 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsISelection;
|
||||
class nsIDocument;
|
||||
|
||||
class nsCopySupport
|
||||
{
|
||||
// class of static helper functions for copy support
|
||||
public:
|
||||
static nsresult HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, PRInt16 aClipboardID);
|
||||
};
|
||||
@@ -1,227 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nsCopySupport.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIDOMNSHTMLInputElement.h"
|
||||
#include "nsIDOMNSHTMLTextAreaElement.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#ifdef IBMBIDI
|
||||
#include "nsIUBidiUtils.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
static NS_DEFINE_CID(kUBidiUtilCID, NS_UNICHARBIDIUTIL_CID);
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
|
||||
static NS_DEFINE_CID(kHTMLConverterCID, NS_HTMLFORMATCONVERTER_CID);
|
||||
static NS_DEFINE_CID(kTextEncoderCID, NS_TEXT_ENCODER_CID);
|
||||
|
||||
// private clipboard data flavors for html copy, used by editor when pasting
|
||||
#define kHTMLContext "text/_moz_htmlcontext"
|
||||
#define kHTMLInfo "text/_moz_htmlinfo"
|
||||
|
||||
|
||||
nsresult nsCopySupport::HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, PRInt16 aClipboardID)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocumentEncoder> docEncoder;
|
||||
|
||||
docEncoder = do_CreateInstance(NS_HTMLCOPY_ENCODER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE);
|
||||
|
||||
rv = docEncoder->Init(aDoc, NS_LITERAL_STRING("text/html"), 0);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = docEncoder->SetSelection(aSel);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsAutoString mimeType;
|
||||
rv = docEncoder->GetMimeType(mimeType);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString buffer, parents, info;
|
||||
PRBool bIsHTMLCopy = PR_FALSE;
|
||||
if (mimeType.EqualsWithConversion("text/html"))
|
||||
bIsHTMLCopy = PR_TRUE;
|
||||
|
||||
if (bIsHTMLCopy)
|
||||
{
|
||||
// encode the selection as html with contextual info
|
||||
rv = docEncoder->EncodeToStringWithContext(buffer, parents, info);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
// encode the selection
|
||||
rv = docEncoder->EncodeToString(buffer);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef IBMBIDI //ahmed
|
||||
rv = NS_OK;
|
||||
PRBool arabicCharset;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc);
|
||||
if (doc) {
|
||||
nsIPresShell* shell = doc->GetShellAt(0);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context) );
|
||||
if (context) {
|
||||
context->IsArabicEncoding(arabicCharset);
|
||||
if (arabicCharset) {
|
||||
nsCOMPtr<nsIUBidiUtils> bidiUtils = do_GetService("@mozilla.org/intl/unicharbidiutil;1");
|
||||
PRUint32 bidiOptions;
|
||||
PRBool isVisual;
|
||||
PRBool isBidiSystem;
|
||||
|
||||
context->GetBidi(&bidiOptions);
|
||||
context->IsVisualMode(isVisual);
|
||||
context->GetIsBidiSystem(isBidiSystem);
|
||||
if ( (GET_BIDI_OPTION_CLIPBOARDTEXTMODE(bidiOptions) == IBMBIDI_CLIPBOARDTEXTMODE_LOGICAL)&&(isVisual)//&&(isBidiSystem)
|
||||
) {
|
||||
nsAutoString newBuffer;
|
||||
if (isBidiSystem) {
|
||||
#if 0 // Until we finalize the conversion routine
|
||||
if (GET_BIDI_OPTION_DIRECTION(bidiOptions) == IBMBIDI_TEXTDIRECTION_LTR) {
|
||||
bidiUtils->Conv_FE_06_WithReverse(buffer, newBuffer);
|
||||
}
|
||||
if (GET_BIDI_OPTION_DIRECTION(bidiOptions) == IBMBIDI_TEXTDIRECTION_RTL) {
|
||||
bidiUtils->Conv_FE_06 (buffer, newBuffer);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else { //nonbidisystem
|
||||
bidiUtils->HandleNumbers(buffer, newBuffer);//ahmed
|
||||
}
|
||||
buffer = newBuffer;
|
||||
}
|
||||
//Mohamed
|
||||
else {
|
||||
#if 0 // Until we finalize the conversion routine
|
||||
nsAutoString bidiCharset;
|
||||
context->GetBidiCharset(bidiCharset);
|
||||
if (bidiCharset.EqualsIgnoreCase("UTF-8") || (!isVisual)) {
|
||||
if ( (GET_BIDI_OPTION_CLIPBOARDTEXTMODE(bidiOptions) == IBMBIDI_CLIPBOARDTEXTMODE_VISUAL) || (!isBidiSystem) ) {
|
||||
nsAutoString newBuffer;
|
||||
bidiUtils->Conv_06_FE_WithReverse(buffer, newBuffer, GET_BIDI_OPTION_DIRECTION(bidiOptions));
|
||||
bidiUtils->HandleNumbers(newBuffer, buffer);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // IBMBIDI
|
||||
|
||||
// Get the Clipboard
|
||||
NS_WITH_SERVICE(nsIClipboard, clipboard, kCClipboardCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if ( clipboard )
|
||||
{
|
||||
// Create a transferable for putting data on the Clipboard
|
||||
nsCOMPtr<nsITransferable> trans = do_CreateInstance(kCTransferableCID);
|
||||
if ( trans )
|
||||
{
|
||||
if (bIsHTMLCopy)
|
||||
{
|
||||
// set up the data converter
|
||||
nsCOMPtr<nsIFormatConverter> htmlConverter = do_CreateInstance(kHTMLConverterCID);
|
||||
NS_ENSURE_TRUE(htmlConverter, NS_ERROR_FAILURE);
|
||||
trans->SetConverter(htmlConverter);
|
||||
}
|
||||
|
||||
// get wStrings to hold clip data
|
||||
nsCOMPtr<nsISupportsWString> dataWrapper, contextWrapper, infoWrapper;
|
||||
dataWrapper = do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID);
|
||||
NS_ENSURE_TRUE(dataWrapper, NS_ERROR_FAILURE);
|
||||
if (bIsHTMLCopy)
|
||||
{
|
||||
contextWrapper = do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID);
|
||||
NS_ENSURE_TRUE(contextWrapper, NS_ERROR_FAILURE);
|
||||
infoWrapper = do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID);
|
||||
NS_ENSURE_TRUE(infoWrapper, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
// populate the strings
|
||||
dataWrapper->SetData ( NS_CONST_CAST(PRUnichar*,buffer.GetUnicode()) );
|
||||
if (bIsHTMLCopy)
|
||||
{
|
||||
contextWrapper->SetData ( NS_CONST_CAST(PRUnichar*,parents.GetUnicode()) );
|
||||
infoWrapper->SetData ( NS_CONST_CAST(PRUnichar*,info.GetUnicode()) );
|
||||
}
|
||||
|
||||
// QI the data object an |nsISupports| so that when the transferable holds
|
||||
// onto it, it will addref the correct interface.
|
||||
nsCOMPtr<nsISupports> genericDataObj ( do_QueryInterface(dataWrapper) );
|
||||
if (bIsHTMLCopy)
|
||||
{
|
||||
if (buffer.Length())
|
||||
{
|
||||
// Add the html DataFlavor to the transferable
|
||||
trans->AddDataFlavor(kHTMLMime);
|
||||
trans->SetTransferData(kHTMLMime, genericDataObj, buffer.Length()*2);
|
||||
}
|
||||
if (parents.Length())
|
||||
{
|
||||
// Add the htmlcontext DataFlavor to the transferable
|
||||
trans->AddDataFlavor(kHTMLContext);
|
||||
genericDataObj = do_QueryInterface(contextWrapper);
|
||||
trans->SetTransferData(kHTMLContext, genericDataObj, parents.Length()*2);
|
||||
}
|
||||
if (info.Length())
|
||||
{
|
||||
// Add the htmlinfo DataFlavor to the transferable
|
||||
trans->AddDataFlavor(kHTMLInfo);
|
||||
genericDataObj = do_QueryInterface(infoWrapper);
|
||||
trans->SetTransferData(kHTMLInfo, genericDataObj, info.Length()*2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buffer.Length())
|
||||
{
|
||||
// Add the unicode DataFlavor to the transferable
|
||||
trans->AddDataFlavor(kUnicodeMime);
|
||||
trans->SetTransferData(kUnicodeMime, genericDataObj, buffer.Length()*2);
|
||||
}
|
||||
}
|
||||
// put the transferable on the clipboard
|
||||
clipboard->SetData(trans, nsnull, aClipboardID);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIHTMLContent_h___
|
||||
#define nsIHTMLContent_h___
|
||||
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsHTMLValue.h"
|
||||
class nsString;
|
||||
class nsIFrame;
|
||||
class nsIStyleRule;
|
||||
class nsIMutableStyleContext;
|
||||
class nsIPresContext;
|
||||
class nsIHTMLMappedAttributes;
|
||||
class nsIURI;
|
||||
|
||||
// IID for the nsIHTMLContent class
|
||||
#define NS_IHTMLCONTENT_IID \
|
||||
{ 0xb9e110b0, 0x94d6, 0x11d1, \
|
||||
{0x89, 0x5c, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
|
||||
|
||||
typedef void (*nsMapAttributesFunc)(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext);
|
||||
|
||||
// Abstract interface for all html content
|
||||
class nsIHTMLContent : public nsIXMLContent
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IHTMLCONTENT_IID)
|
||||
|
||||
/**
|
||||
* If this html content is a container, then compact asks it to minimize
|
||||
* it's storage usage.
|
||||
*/
|
||||
NS_IMETHOD Compact() = 0;
|
||||
|
||||
NS_IMETHOD SetHTMLAttribute(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
NS_IMETHOD GetHTMLAttribute(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue) const = 0;
|
||||
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const = 0;
|
||||
|
||||
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsAWritableString& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsAReadableString& aValue,
|
||||
nsHTMLValue& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the base URL for any relative URLs within this piece
|
||||
* of content. Generally, this is the document's base URL,
|
||||
* but certain content carries a local base for backward
|
||||
* compatibility.
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const = 0;
|
||||
|
||||
/**
|
||||
* Get the base target for any links within this piece
|
||||
* of content. Generally, this is the document's base target,
|
||||
* but certain content carries a local base for backward
|
||||
* compatibility.
|
||||
*/
|
||||
NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIHTMLContent_h___ */
|
||||
31
mozilla/js/src/MANIFEST
Normal file
31
mozilla/js/src/MANIFEST
Normal file
@@ -0,0 +1,31 @@
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
jsapi.h
|
||||
jspubtd.h
|
||||
jsarray.h
|
||||
jsatom.h
|
||||
jsbool.h
|
||||
jscntxt.h
|
||||
jscompat.h
|
||||
jsconfig.h
|
||||
jsdate.h
|
||||
jsdbgapi.h
|
||||
jsemit.h
|
||||
jsfun.h
|
||||
jsgc.h
|
||||
jsinterp.h
|
||||
jslock.h
|
||||
jsmath.h
|
||||
jsnum.h
|
||||
jsobj.h
|
||||
jsopcode.def
|
||||
jsopcode.h
|
||||
jsparse.h
|
||||
jsprvtd.h
|
||||
jspubtd.h
|
||||
jsregexp.h
|
||||
jsscan.h
|
||||
jsscope.h
|
||||
jsscript.h
|
||||
jsstr.h
|
||||
236
mozilla/js/src/Makefile
Normal file
236
mozilla/js/src/Makefile
Normal file
@@ -0,0 +1,236 @@
|
||||
#! gmake
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../..
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
ifdef MOZ_OJI
|
||||
DIRS = liveconnect
|
||||
endif
|
||||
|
||||
LIBRARY_NAME = js
|
||||
|
||||
ifeq ($(subst /,_,$(shell uname -s)),OS2)
|
||||
ifndef XCFLAGS
|
||||
OS2_IMPLIB=1
|
||||
LIBRARY = js$(MOZ_BITS)$(VERSION_NUMBER).$(LIB_SUFFIX)
|
||||
DEF_FILE = jsos2$(VERSION_NUMBER).def
|
||||
EXTRA_LIBS = $(LIBNSPR) $(LIBNSJAVA)
|
||||
else
|
||||
EXTRA_LIBS = $(LIBNSPR) $(LIBNSJAVA) $(OBJDIR)/libjs.lib
|
||||
endif
|
||||
endif
|
||||
|
||||
MODULE = js
|
||||
|
||||
CSRCS = jsapi.c \
|
||||
jsarray.c \
|
||||
jsatom.c \
|
||||
jsbool.c \
|
||||
jscntxt.c \
|
||||
jsdate.c \
|
||||
jsdbgapi.c \
|
||||
jsemit.c \
|
||||
jsfun.c \
|
||||
jsgc.c \
|
||||
jsinterp.c \
|
||||
jsmath.c \
|
||||
jsnum.c \
|
||||
jsobj.c \
|
||||
jsopcode.c \
|
||||
jsparse.c \
|
||||
jsregexp.c \
|
||||
jsscan.c \
|
||||
jsscope.c \
|
||||
jsscript.c \
|
||||
jsstr.c \
|
||||
jslock.c \
|
||||
jsxdrapi.c \
|
||||
prmjtime.c \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = jsapi.h \
|
||||
jsarray.h \
|
||||
jsatom.h \
|
||||
jsbool.h \
|
||||
jscntxt.h \
|
||||
jscompat.h \
|
||||
jsconfig.h \
|
||||
jsdate.h \
|
||||
jsdbgapi.h \
|
||||
jsemit.h \
|
||||
jsfun.h \
|
||||
jsgc.h \
|
||||
jsinterp.h \
|
||||
jslock.h \
|
||||
jsmath.h \
|
||||
jsnum.h \
|
||||
jsobj.h \
|
||||
jsopcode.def \
|
||||
jsopcode.h \
|
||||
jsparse.h \
|
||||
jsprvtd.h \
|
||||
jspubtd.h \
|
||||
jsregexp.h \
|
||||
jsscan.h \
|
||||
jsscope.h \
|
||||
jsscript.h \
|
||||
jsstr.h \
|
||||
jsxdrapi.h \
|
||||
$(NULL)
|
||||
|
||||
# when using gcc the assembly is inlined in the C-file (see jslock.c)
|
||||
ifdef NS_USE_NATIVE
|
||||
ASFILES = $(wildcard *_$(OS_ARCH).s)
|
||||
endif
|
||||
|
||||
JS_SAFE_ARENA = 1
|
||||
|
||||
ifdef JS_SAFE_ARENA
|
||||
DEFINES += -DJS_USE_SAFE_ARENA
|
||||
CSRCS += prarena.c
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
ifndef BUILD_OPT
|
||||
MOCHAFILE = 1
|
||||
endif
|
||||
|
||||
ifdef JSFILE
|
||||
DEFINES += -DJSFILE
|
||||
endif
|
||||
|
||||
ifdef JS_THREADSAFE
|
||||
DEFINES += -DJS_THREADSAFE
|
||||
endif
|
||||
|
||||
ifdef JS_NO_THIN_LOCKS
|
||||
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
|
||||
endif
|
||||
|
||||
ifdef JS_VERSION
|
||||
DEFINES += -DJS_VERSION=$(JS_VERSION)
|
||||
endif
|
||||
|
||||
ifeq ($(CPU_ARCH),sparc)
|
||||
|
||||
ifndef JS_NO_ULTRA
|
||||
ULTRA_OPTIONS := -xarch=v8plus,-DULTRA_SPARC
|
||||
ULTRA_OPTIONSCC := -DULTRA_SPARC
|
||||
else
|
||||
ULTRA_OPTIONS := -xarch=v8
|
||||
ULTRA_OPTIONSCC :=
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname -m),sun4u)
|
||||
ASFLAGS += -Wa,$(ULTRA_OPTIONS),-P,-L,-D_ASM,-D__STDC__=0 $(ULTRA_OPTIONSCC)
|
||||
else
|
||||
ASFLAGS += -Wa,-xarch=v8,-P,-L,-D_ASM,-D__STDC__=0
|
||||
endif
|
||||
|
||||
endif # sparc
|
||||
|
||||
INCLUDES += -I.
|
||||
|
||||
ifdef NSPR20
|
||||
INCLUDES += -I$(DIST)/include/nspr20/pr
|
||||
else
|
||||
INCLUDES += -I$(XPDIST)/public/nspr
|
||||
endif
|
||||
|
||||
ifndef NSBUILDROOT
|
||||
JSJAVA_STUBHEADERS = -I$(DEPTH)/sun-java/include/_gen \
|
||||
-I$(DEPTH)/sun-java/netscape/javascript/_jri \
|
||||
-I$(DEPTH)/sun-java/netscape/security/_jri
|
||||
else
|
||||
JSJAVA_STUBHEADERS = -I$(JRI_GEN_DIR) -I$(JDK_GEN_DIR)
|
||||
endif
|
||||
|
||||
JSJAVA_CFLAGS = -I$(DEPTH)/sun-java/md-include \
|
||||
-I$(DEPTH)/sun-java/include \
|
||||
$(JSJAVA_STUBHEADERS)
|
||||
|
||||
# LIBNSPR includes unneeded libmsgc21.a, but abstracts nspr version,
|
||||
# etc. nicely.
|
||||
LDFLAGS = $(LIBNSPR) -lm
|
||||
|
||||
ifeq ($(OS_ARCH), OSF1)
|
||||
LDFLAGS += -lc_r
|
||||
endif
|
||||
ifeq ($(OS_ARCH), SunOS)
|
||||
LDFLAGS += -lposix4 -ldl -lnsl -lsocket
|
||||
endif
|
||||
ifeq ($(OS_ARCH), Linux)
|
||||
LDFLAGS += -ldl
|
||||
endif
|
||||
|
||||
# this requires clobbering and recompiling with XCFLAGS=-DJSFILE
|
||||
js:
|
||||
$(MAKE) clobber
|
||||
$(MAKE) XCFLAGS=-DJSFILE $(OBJDIR)/js$(BIN_SUFFIX)
|
||||
|
||||
.PHONY: js$(BIN_SUFFIX)
|
||||
|
||||
ifneq ($(OS_ARCH),OS2)
|
||||
$(OBJDIR)/js$(BIN_SUFFIX): $(OBJDIR)/js.o $(LIBRARY)
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CC) -o $@ $(OBJDIR)/js.o $(LIBRARY) $(LDFLAGS)
|
||||
else
|
||||
OS_CFLAGS += -tm-
|
||||
$(OBJDIR)/js$(BIN_SUFFIX): $(OBJDIR)/js.o $(LIBRARY)
|
||||
@$(MAKE_OBJDIR)
|
||||
$(LINK_EXE) -OUT:$@ $(OBJDIR)/js.o $(LIBRARIES) $(EXTRA_LIBS)
|
||||
endif
|
||||
|
||||
# hardwire dependencies on jsopcode.def
|
||||
jsopcode.h jsopcode.c: jsopcode.def
|
||||
|
||||
# this section was put in the merged by danda into the
|
||||
# JAVA_*_MERGE section and normally would have
|
||||
# been removed. However it looks like it shouldn't have
|
||||
# been put there in the first place, so we're leaving it
|
||||
# here until danda can confirm (we don't have OS/2 machines
|
||||
# to build on) - hshaw/sudu
|
||||
#
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
$(OBJDIR)/js.o: js.c
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) $(JSJAVA_CFLAGS) js.c
|
||||
endif
|
||||
|
||||
|
||||
refdiff:
|
||||
@for f in `cat commfiles`; do \
|
||||
t=/tmp/refdiff.$$$$; \
|
||||
trap 'rm -f $$t' 0 1 2 15; \
|
||||
sed -f prconv.sed ../ref/$$f > $$t; \
|
||||
cmp -s $$t $$f; \
|
||||
if test $$? -ne 0; then \
|
||||
echo "=== $$f"; \
|
||||
diff $$f $$t; \
|
||||
fi; \
|
||||
rm -f $$t; \
|
||||
done
|
||||
|
||||
refconv:
|
||||
@for f in `cat commfiles`; do \
|
||||
echo "=== $$f"; \
|
||||
sed -f prconv.sed ../ref/$$f > $$f; \
|
||||
done
|
||||
|
||||
.PHONY: refdiff refconv
|
||||
241
mozilla/js/src/Makefile.in
Normal file
241
mozilla/js/src/Makefile.in
Normal file
@@ -0,0 +1,241 @@
|
||||
#! gmake
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ifdef MOZ_OJI
|
||||
DIRS = liveconnect
|
||||
endif
|
||||
|
||||
LIBRARY_NAME = js
|
||||
|
||||
ifeq ($(subst /,_,$(shell uname -s)),OS2)
|
||||
ifndef XCFLAGS
|
||||
OS2_IMPLIB=1
|
||||
LIBRARY = js$(MOZ_BITS)$(VERSION_NUMBER).$(LIB_SUFFIX)
|
||||
DEF_FILE = jsos2$(VERSION_NUMBER).def
|
||||
EXTRA_LIBS = $(LIBNSPR) $(LIBNSJAVA)
|
||||
else
|
||||
EXTRA_LIBS = $(LIBNSPR) $(LIBNSJAVA) $(OBJDIR)/libjs.lib
|
||||
endif
|
||||
endif
|
||||
|
||||
MODULE = js
|
||||
|
||||
CSRCS = jsapi.c \
|
||||
jsarray.c \
|
||||
jsatom.c \
|
||||
jsbool.c \
|
||||
jscntxt.c \
|
||||
jsdate.c \
|
||||
jsdbgapi.c \
|
||||
jsemit.c \
|
||||
jsfun.c \
|
||||
jsgc.c \
|
||||
jsinterp.c \
|
||||
jsmath.c \
|
||||
jsnum.c \
|
||||
jsobj.c \
|
||||
jsopcode.c \
|
||||
jsparse.c \
|
||||
jsregexp.c \
|
||||
jsscan.c \
|
||||
jsscope.c \
|
||||
jsscript.c \
|
||||
jsstr.c \
|
||||
jslock.c \
|
||||
jsxdrapi.c \
|
||||
prmjtime.c \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = jsapi.h \
|
||||
jsarray.h \
|
||||
jsatom.h \
|
||||
jsbool.h \
|
||||
jscntxt.h \
|
||||
jscompat.h \
|
||||
jsconfig.h \
|
||||
jsdate.h \
|
||||
jsdbgapi.h \
|
||||
jsemit.h \
|
||||
jsfun.h \
|
||||
jsgc.h \
|
||||
jsinterp.h \
|
||||
jslock.h \
|
||||
jsmath.h \
|
||||
jsnum.h \
|
||||
jsobj.h \
|
||||
jsopcode.def \
|
||||
jsopcode.h \
|
||||
jsparse.h \
|
||||
jsprvtd.h \
|
||||
jspubtd.h \
|
||||
jsregexp.h \
|
||||
jsscan.h \
|
||||
jsscope.h \
|
||||
jsscript.h \
|
||||
jsstr.h \
|
||||
jsxdrapi.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
# when using gcc the assembly is inlined in the C-file (see jslock.c)
|
||||
ifdef NS_USE_NATIVE
|
||||
ASFILES = $(wildcard $(srcdir)/*_$(OS_ARCH).s)
|
||||
endif
|
||||
|
||||
JS_SAFE_ARENA = 1
|
||||
|
||||
ifdef JS_SAFE_ARENA
|
||||
DEFINES += -DJS_USE_SAFE_ARENA
|
||||
CSRCS += prarena.c
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifndef BUILD_OPT
|
||||
MOCHAFILE = 1
|
||||
endif
|
||||
|
||||
ifdef JSFILE
|
||||
DEFINES += -DJSFILE
|
||||
endif
|
||||
|
||||
ifdef JS_THREADSAFE
|
||||
DEFINES += -DJS_THREADSAFE
|
||||
endif
|
||||
|
||||
ifdef JS_NO_THIN_LOCKS
|
||||
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
|
||||
endif
|
||||
|
||||
ifdef JS_VERSION
|
||||
DEFINES += -DJS_VERSION=$(JS_VERSION)
|
||||
endif
|
||||
|
||||
ifeq ($(CPU_ARCH),sparc)
|
||||
|
||||
ifndef JS_NO_ULTRA
|
||||
ULTRA_OPTIONS := -xarch=v8plus,-DULTRA_SPARC
|
||||
ULTRA_OPTIONSCC := -DULTRA_SPARC
|
||||
else
|
||||
ULTRA_OPTIONS := -xarch=v8
|
||||
ULTRA_OPTIONSCC :=
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname -m),sun4u)
|
||||
ASFLAGS += -Wa,$(ULTRA_OPTIONS),-P,-L,-D_ASM,-D__STDC__=0 $(ULTRA_OPTIONSCC)
|
||||
else
|
||||
ASFLAGS += -Wa,-xarch=v8,-P,-L,-D_ASM,-D__STDC__=0
|
||||
endif
|
||||
|
||||
endif # sparc
|
||||
|
||||
INCLUDES += -I$(srcdir)
|
||||
|
||||
ifdef NSPR20
|
||||
INCLUDES += -I$(DIST)/include/nspr20/pr
|
||||
else
|
||||
INCLUDES += -I$(XPDIST)/public/nspr
|
||||
endif
|
||||
|
||||
ifndef NSBUILDROOT
|
||||
JSJAVA_STUBHEADERS = -I$(topsrcdir)/sun-java/include/_gen \
|
||||
-I$(topsrcdir)/sun-java/netscape/javascript/_jri \
|
||||
-I$(topsrcdir)/sun-java/netscape/security/_jri
|
||||
else
|
||||
JSJAVA_STUBHEADERS = -I$(JRI_GEN_DIR) -I$(JDK_GEN_DIR)
|
||||
endif
|
||||
|
||||
JSJAVA_CFLAGS = -I$(topsrcdir)/sun-java/md-include \
|
||||
-I$(topsrcdir)/sun-java/include \
|
||||
$(JSJAVA_STUBHEADERS)
|
||||
|
||||
# LIBNSPR includes unneeded libmsgc21.a, but abstracts nspr version,
|
||||
# etc. nicely.
|
||||
LDFLAGS = $(LIBNSPR) -lm
|
||||
|
||||
ifeq ($(OS_ARCH), OSF1)
|
||||
LDFLAGS += -lc_r
|
||||
endif
|
||||
ifeq ($(OS_ARCH), SunOS)
|
||||
LDFLAGS += -lposix4 -ldl -lnsl -lsocket
|
||||
endif
|
||||
ifeq ($(OS_ARCH), Linux)
|
||||
LDFLAGS += -ldl
|
||||
endif
|
||||
|
||||
# this requires clobbering and recompiling with XCFLAGS=-DJSFILE
|
||||
js:
|
||||
$(MAKE) clobber
|
||||
$(MAKE) XCFLAGS=-DJSFILE $(OBJDIR)/js$(BIN_SUFFIX)
|
||||
|
||||
.PHONY: js$(BIN_SUFFIX)
|
||||
|
||||
ifneq ($(OS_ARCH),OS2)
|
||||
$(OBJDIR)/js$(BIN_SUFFIX): $(OBJDIR)/js.o $(LIBRARY)
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CC) -o $@ $(OBJDIR)/js.o $(LIBRARY) $(LDFLAGS)
|
||||
else
|
||||
OS_CFLAGS += -tm-
|
||||
$(OBJDIR)/js$(BIN_SUFFIX): $(OBJDIR)/js.o $(LIBRARY)
|
||||
@$(MAKE_OBJDIR)
|
||||
$(LINK_EXE) -OUT:$@ $(OBJDIR)/js.o $(LIBRARIES) $(EXTRA_LIBS)
|
||||
endif
|
||||
|
||||
# hardwire dependencies on jsopcode.def
|
||||
jsopcode.h jsopcode.c: jsopcode.def
|
||||
|
||||
# this section was put in the merged by danda into the
|
||||
# JAVA_*_MERGE section and normally would have
|
||||
# been removed. However it looks like it shouldn't have
|
||||
# been put there in the first place, so we're leaving it
|
||||
# here until danda can confirm (we don't have OS/2 machines
|
||||
# to build on) - hshaw/sudu
|
||||
#
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
$(OBJDIR)/js.o: js.c
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) $(JSJAVA_CFLAGS) js.c
|
||||
endif
|
||||
|
||||
|
||||
refdiff:
|
||||
@for f in `cat commfiles`; do \
|
||||
t=/tmp/refdiff.$$$$; \
|
||||
trap 'rm -f $$t' 0 1 2 15; \
|
||||
sed -f prconv.sed ../ref/$$f > $$t; \
|
||||
cmp -s $$t $$f; \
|
||||
if test $$? -ne 0; then \
|
||||
echo "=== $$f"; \
|
||||
diff $$f $$t; \
|
||||
fi; \
|
||||
rm -f $$t; \
|
||||
done
|
||||
|
||||
refconv:
|
||||
@for f in `cat commfiles`; do \
|
||||
echo "=== $$f"; \
|
||||
sed -f prconv.sed ../ref/$$f > $$f; \
|
||||
done
|
||||
|
||||
.PHONY: refdiff refconv
|
||||
316
mozilla/js/src/Makefile.ref
Normal file
316
mozilla/js/src/Makefile.ref
Normal file
@@ -0,0 +1,316 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
#
|
||||
# JSRef GNUmake makefile.
|
||||
#
|
||||
|
||||
# Set os+release dependent make variables
|
||||
OS_ARCH := $(subst /,_,$(shell uname -s))
|
||||
|
||||
# Attempt to differentiate between SunOS 5.4 and x86 5.4
|
||||
OS_CPUARCH := $(shell uname -m)
|
||||
ifeq ($(OS_CPUARCH),i86pc)
|
||||
OS_RELEASE := $(shell uname -r)_$(OS_CPUARCH)
|
||||
else
|
||||
ifeq ($(OS_ARCH),AIX)
|
||||
OS_RELEASE := $(shell uname -v).$(shell uname -r)
|
||||
else
|
||||
OS_RELEASE := $(shell uname -r)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Virtually all Linux versions are identical.
|
||||
# Any distinctions are handled in linux.h
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
OS_CONFIG := Linux_All
|
||||
else
|
||||
ifeq ($(OS_ARCH),dgux)
|
||||
OS_CONFIG := dgux
|
||||
else
|
||||
OS_CONFIG := $(OS_ARCH)$(OS_OBJTYPE)$(OS_RELEASE)
|
||||
endif
|
||||
endif
|
||||
|
||||
ASFLAGS =
|
||||
DEFINES =
|
||||
|
||||
#NS_USE_NATIVE = 1
|
||||
|
||||
include config/$(OS_CONFIG).mk
|
||||
|
||||
ifdef BUILD_OPT
|
||||
OPTIMIZER += -O
|
||||
DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(shell whoami)
|
||||
OBJDIR_TAG = _OPT
|
||||
else
|
||||
ifdef USE_MSVC
|
||||
OPTIMIZER = -Zi
|
||||
else
|
||||
OPTIMIZER = -g
|
||||
endif
|
||||
DEFINES += -DDEBUG -DDEBUG_$(shell whoami)
|
||||
OBJDIR_TAG = _DBG
|
||||
endif
|
||||
|
||||
#DEFINES += -DJS_THREADSAFE
|
||||
|
||||
ifdef JS_NO_THIN_LOCKS
|
||||
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
|
||||
endif
|
||||
|
||||
# Name of the binary code directories
|
||||
OBJDIR = $(OS_CONFIG)$(OBJDIR_TAG).OBJ
|
||||
VPATH = $(OBJDIR)
|
||||
|
||||
# Automatic make dependencies file
|
||||
DEPENDENCIES = $(OBJDIR)/.md
|
||||
|
||||
define MAKE_OBJDIR
|
||||
if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi
|
||||
endef
|
||||
|
||||
# Look in OBJDIR to find prcpucfg.h
|
||||
INCLUDES = -I$(OBJDIR)
|
||||
|
||||
#
|
||||
# XCFLAGS may be set in the environment or on the gmake command line
|
||||
#
|
||||
CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) \
|
||||
-DJSFILE $(XCFLAGS)
|
||||
LDFLAGS = -lm $(XLDFLAGS)
|
||||
|
||||
#
|
||||
# Ask perl what flags it was built with, so we can build js with similar flags
|
||||
# and link properly. Viva gmake.
|
||||
#
|
||||
ifdef PERLCONNECT
|
||||
DEFINES += -DPERLCONNECT
|
||||
|
||||
PERLCFLAGS := $(shell perl -MExtUtils::Embed -e ccopts)
|
||||
PERLLDFLAGS := $(shell perl -MExtUtils::Embed -e ldopts)
|
||||
|
||||
CFLAGS += $(PERLCFLAGS)
|
||||
LDFLAGS += $(PERLLDFLAGS)
|
||||
endif
|
||||
|
||||
# For purify
|
||||
PURE_CFLAGS = -DXP_UNIX $(OPTIMIZER) $(PURE_OS_CFLAGS) $(DEFINES) \
|
||||
$(INCLUDES) $(XCFLAGS)
|
||||
|
||||
#
|
||||
# JS file lists
|
||||
#
|
||||
JS_HFILES = \
|
||||
jsarray.h \
|
||||
jsatom.h \
|
||||
jsbool.h \
|
||||
jsconfig.h \
|
||||
jscntxt.h \
|
||||
jsdate.h \
|
||||
jsemit.h \
|
||||
jsexn.h \
|
||||
jsfun.h \
|
||||
jsgc.h \
|
||||
jsinterp.h \
|
||||
jslock.h \
|
||||
jsmath.h \
|
||||
jsnum.h \
|
||||
jsobj.h \
|
||||
jsopcode.h \
|
||||
jsparse.h \
|
||||
jsarena.h \
|
||||
jsclist.h \
|
||||
jsdtoa.h \
|
||||
jshash.h \
|
||||
jslong.h \
|
||||
jsmacos.h \
|
||||
jsosdep.h \
|
||||
jspcos.h \
|
||||
jsprintf.h \
|
||||
jstime.h \
|
||||
jstypes.h \
|
||||
jsprvtd.h \
|
||||
jspubtd.h \
|
||||
jsregexp.h \
|
||||
jsscan.h \
|
||||
jsscope.h \
|
||||
jsscript.h \
|
||||
jsstr.h \
|
||||
jsxdrapi.h \
|
||||
$(NULL)
|
||||
|
||||
API_HFILES = \
|
||||
jsapi.h \
|
||||
jsdbgapi.h \
|
||||
$(NULL)
|
||||
|
||||
HFILES = $(JS_HFILES) $(API_HFILES)
|
||||
|
||||
JS_CFILES = \
|
||||
jsapi.c \
|
||||
jsarray.c \
|
||||
jsatom.c \
|
||||
jsbool.c \
|
||||
jscntxt.c \
|
||||
jsdate.c \
|
||||
jsdbgapi.c \
|
||||
jsemit.c \
|
||||
jsexn.c \
|
||||
jsfun.c \
|
||||
jsgc.c \
|
||||
jsinterp.c \
|
||||
jslock.c \
|
||||
jsmath.c \
|
||||
jsnum.c \
|
||||
jsobj.c \
|
||||
jsopcode.c \
|
||||
jsparse.c \
|
||||
jsarena.c \
|
||||
jsdtoa.c \
|
||||
jshash.c \
|
||||
jslog2.c \
|
||||
jslong.c \
|
||||
jsprf.c \
|
||||
jsregexp.c \
|
||||
jsscan.c \
|
||||
jsscope.c \
|
||||
jsscript.c \
|
||||
jsstr.c \
|
||||
jsutil.c \
|
||||
jsxdrapi.c \
|
||||
prmjtime.c \
|
||||
$(NULL)
|
||||
|
||||
ifdef PERLCONNECT
|
||||
JS_CFILES += jsperl.c
|
||||
endif
|
||||
|
||||
LIB_CFILES = $(JS_CFILES)
|
||||
LIB_ASFILES := $(wildcard *_$(OS_ARCH).s)
|
||||
PROG_CFILES = js.c
|
||||
|
||||
ifdef USE_MSVC
|
||||
LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CFILES:.c=.obj))
|
||||
PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CFILES:.c=.obj))
|
||||
else
|
||||
LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CFILES:.c=.o))
|
||||
LIB_OBJS += $(addprefix $(OBJDIR)/, $(LIB_ASFILES:.s=.o))
|
||||
PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CFILES:.c=.o))
|
||||
endif
|
||||
|
||||
CFILES = $(LIB_CFILES) $(PROG_CFILES)
|
||||
OBJS = $(LIB_OBJS) $(PROG_OBJS)
|
||||
|
||||
ifdef USE_MSVC
|
||||
LIBRARY = $(OBJDIR)/js32.dll
|
||||
PROGRAM = $(OBJDIR)/js
|
||||
else
|
||||
LIBRARY = $(OBJDIR)/libjs.a
|
||||
PROGRAM = $(OBJDIR)/js
|
||||
endif
|
||||
|
||||
ifdef USE_MSVC
|
||||
TARGETS = $(LIBRARY) # $(PROGRAM) not supported for MSVC yet
|
||||
else
|
||||
TARGETS = $(LIBRARY) $(PROGRAM)
|
||||
endif
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJS)
|
||||
|
||||
clobber:
|
||||
rm -rf $(OBJS) $(TARGETS) $(DEPENDENCIES)
|
||||
|
||||
depend:
|
||||
gcc -MM $(CFLAGS) $(JS_CFILES)
|
||||
|
||||
$(OBJDIR)/%: %.c
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CC) -o $@ $(CFLAGS) $*.c $(LDFLAGS)
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CC) -o $@ -c $(CFLAGS) $*.c
|
||||
|
||||
$(OBJDIR)/%.o: %.s
|
||||
@$(MAKE_OBJDIR)
|
||||
$(AS) -o $@ $(ASFLAGS) $*.s
|
||||
|
||||
# windows only
|
||||
$(OBJDIR)/%.obj: %.c
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $*.c
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
$(LIBRARY): $(LIB_OBJS)
|
||||
$(AR) $@ $? $(AR_OS2_SUFFIX)
|
||||
$(RANLIB) $@
|
||||
else
|
||||
ifdef USE_MSVC
|
||||
$(LIBRARY): $(LIB_OBJS)
|
||||
link.exe $(LIB_LINK_FLAGS) /base:0x61000000 \
|
||||
/out:"$@" /pdb:"$(OBJDIR)/js32.pdb" /implib:"$(OBJDIR)/js32.lib" $?
|
||||
else
|
||||
$(LIBRARY): $(LIB_OBJS)
|
||||
$(AR) rv $@ $?
|
||||
$(RANLIB) $@
|
||||
endif
|
||||
endif
|
||||
|
||||
#NSPR_LIBRARY = ../../dist/$(OBJDIR)/lib/libnspr21.so
|
||||
NSPR_LIBRARY =
|
||||
|
||||
$(PROGRAM): $(PROG_OBJS) $(LIBRARY)
|
||||
$(CC) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(NSPR_LIBRARY) $(LDFLAGS)
|
||||
|
||||
$(PROGRAM).pure: $(PROG_OBJS) $(LIBRARY)
|
||||
purify $(PUREFLAGS) \
|
||||
$(CC) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS)
|
||||
|
||||
$(HFILES) $(CFILES): $(OBJDIR)/jscpucfg.h
|
||||
|
||||
ifdef PREBUILT_CPUCFG
|
||||
$(OBJDIR)/jscpucfg.h: jscpucfg.h
|
||||
cp jscpucfg.h $(OBJDIR)
|
||||
else
|
||||
$(OBJDIR)/jscpucfg.h: $(OBJDIR)/jscpucfg
|
||||
rm -f $@
|
||||
$(OBJDIR)/jscpucfg > $@
|
||||
|
||||
$(OBJDIR)/jscpucfg: $(OBJDIR)/jscpucfg.o
|
||||
$(CC) -o $@ $(OBJDIR)/jscpucfg.o
|
||||
endif
|
||||
|
||||
#
|
||||
# Hardwire dependencies on jsopcode.tbl
|
||||
#
|
||||
jsopcode.h jsopcode.c: jsopcode.tbl
|
||||
|
||||
-include $(DEPENDENCIES)
|
||||
|
||||
TARNAME = jsref.tar
|
||||
TARFILES = files `cat files`
|
||||
|
||||
tar:
|
||||
tar cvf $(TARNAME) $(TARFILES)
|
||||
gzip $(TARNAME)
|
||||
|
||||
SUFFIXES: .i
|
||||
%.i: %.c
|
||||
$(CC) -C -E $(CFLAGS) $< > $*.i
|
||||
17
mozilla/js/src/README
Normal file
17
mozilla/js/src/README
Normal file
@@ -0,0 +1,17 @@
|
||||
The js/ref directory contains standalone ANSI-C source for the Netscape
|
||||
JavaScript Reference implementation, JSRef, which was licensed to over 180
|
||||
companies as part of Netscape ONE, starting in fall 1996. Now, JSRef is
|
||||
available under NPL from http://www.mozilla.org.
|
||||
|
||||
The js/src directory contains source files listed in the file "commfiles",
|
||||
that are derived via prconv.sed from counterparts in the js/ref directory.
|
||||
It also contains files such as jscompat.h that are not needed in js/ref.
|
||||
The Makefile in js/src has refconv and refdiff targets to help keep js/ref
|
||||
and js/src in synch.
|
||||
|
||||
If you think you need to change a file listed in commfiles here, please
|
||||
make the change in js/ref first and then use prconv.sed or gmake refconv to
|
||||
get it into js/src. If you have trouble, please let us know by mailing the
|
||||
JS owner and peers listed in http://www.mozilla.org/owners.html#JavaScript.
|
||||
|
||||
Brendan Eich (brendan@mozilla.org), 15-May-98
|
||||
100
mozilla/js/src/actra.mk
Normal file
100
mozilla/js/src/actra.mk
Normal file
@@ -0,0 +1,100 @@
|
||||
#! gmake
|
||||
|
||||
#
|
||||
# Since everyone seems to need to have their own build configuration
|
||||
# system these days, this is yet another makefile to build JavaScript.
|
||||
# This makefile conforms to the NSPR20 build rules. If you have built
|
||||
# NSPR20 this will build JS and stick the lib and bin files over in
|
||||
# the dist area created by NSPR (which is different from the dist
|
||||
# expected by the client and also the dist expected by LiveWire, but
|
||||
# don't get me started).
|
||||
#
|
||||
# I don't currently know enough about what sort of JS-engine the Actra
|
||||
# projects are going to expect so I don't know if we need to add
|
||||
# to CFLAGS for -DJS_THREADSAFE or -DJSFILE
|
||||
#
|
||||
|
||||
MOD_DEPTH = ../../nspr20
|
||||
|
||||
include $(MOD_DEPTH)/config/config.mk
|
||||
|
||||
INCLUDES = -I$(DIST)/include
|
||||
CFLAGS += -DNSPR20
|
||||
|
||||
CSRCS = prmjtime.c \
|
||||
jsapi.c \
|
||||
jsarray.c \
|
||||
jsatom.c \
|
||||
jsbool.c \
|
||||
jscntxt.c \
|
||||
jsdate.c \
|
||||
jsdbgapi.c \
|
||||
jsemit.c \
|
||||
jsfun.c \
|
||||
jsgc.c \
|
||||
jsinterp.c \
|
||||
jsmath.c \
|
||||
jsnum.c \
|
||||
jsobj.c \
|
||||
jsopcode.c \
|
||||
jsparse.c \
|
||||
jsregexp.c \
|
||||
jsscan.c \
|
||||
jsscope.c \
|
||||
jsscript.c \
|
||||
jsstr.c \
|
||||
jslock.c \
|
||||
$(NULL)
|
||||
|
||||
HEADERS = jsapi.h \
|
||||
jsarray.h \
|
||||
jsatom.h \
|
||||
jsbool.h \
|
||||
jscntxt.h \
|
||||
jscompat.h \
|
||||
jsconfig.h \
|
||||
jsdate.h \
|
||||
jsdbgapi.h \
|
||||
jsemit.h \
|
||||
jsfun.h \
|
||||
jsgc.h \
|
||||
jsinterp.h \
|
||||
jslock.h \
|
||||
jsmath.h \
|
||||
jsnum.h \
|
||||
jsobj.h \
|
||||
jsopcode.def \
|
||||
jsopcode.h \
|
||||
jsparse.h \
|
||||
jsprvtd.h \
|
||||
jspubtd.h \
|
||||
jsregexp.h \
|
||||
jsscan.h \
|
||||
jsscope.h \
|
||||
jsscript.h \
|
||||
jsstr.h \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH), WINNT)
|
||||
EXTRA_LIBS += $(DIST)/lib/libnspr$(MOD_VERSION).lib
|
||||
EXTRA_LIBS += $(DIST)/lib/libplds$(MOD_VERSION).lib
|
||||
else
|
||||
EXTRA_LIBS += -L$(DIST)/lib -lnspr$(MOD_VERSION) -lnplds$(MOD_VERSION)
|
||||
endif
|
||||
|
||||
LIBRARY_NAME = js
|
||||
LIBRARY_VERSION = $(MOD_VERSION)
|
||||
|
||||
RELEASE_HEADERS = $(HEADERS)
|
||||
RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
|
||||
RELEASE_LIBS = $(TARGETS)
|
||||
|
||||
include $(MOD_DEPTH)/config/rules.mk
|
||||
|
||||
export:: $(TARGETS)
|
||||
$(INSTALL) -m 444 $(HEADERS) $(MOD_DEPTH)/../dist/public/$(LIBRARY_NAME)
|
||||
$(INSTALL) -m 444 $(TARGETS) $(DIST)/lib
|
||||
$(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/bin
|
||||
|
||||
install:: export
|
||||
|
||||
51
mozilla/js/src/commfiles
Normal file
51
mozilla/js/src/commfiles
Normal file
@@ -0,0 +1,51 @@
|
||||
js.c
|
||||
jsapi.c
|
||||
jsapi.h
|
||||
jsarray.c
|
||||
jsarray.h
|
||||
jsatom.c
|
||||
jsatom.h
|
||||
jsbool.c
|
||||
jsbool.h
|
||||
jscntxt.c
|
||||
jscntxt.h
|
||||
jsconfig.h
|
||||
jsdate.c
|
||||
jsdate.h
|
||||
jsdbgapi.c
|
||||
jsdbgapi.h
|
||||
jsemit.c
|
||||
jsemit.h
|
||||
jsfun.c
|
||||
jsfun.h
|
||||
jsgc.c
|
||||
jsgc.h
|
||||
jsinterp.c
|
||||
jsinterp.h
|
||||
jslock.h
|
||||
jslock.c
|
||||
jsmath.c
|
||||
jsmath.h
|
||||
jsnum.c
|
||||
jsnum.h
|
||||
jsobj.c
|
||||
jsobj.h
|
||||
jsopcode.c
|
||||
jsopcode.def
|
||||
jsopcode.h
|
||||
jsparse.c
|
||||
jsparse.h
|
||||
jsprvtd.h
|
||||
jspubtd.h
|
||||
jsregexp.c
|
||||
jsregexp.h
|
||||
jsscan.c
|
||||
jsscan.h
|
||||
jsscope.c
|
||||
jsscope.h
|
||||
jsscript.c
|
||||
jsscript.h
|
||||
jsstr.c
|
||||
jsstr.h
|
||||
jsxdrapi.h
|
||||
jsxdrapi.c
|
||||
37
mozilla/js/src/config/AIX4.1.mk
Normal file
37
mozilla/js/src/config/AIX4.1.mk
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for AIX
|
||||
#
|
||||
|
||||
CC = xlC_r
|
||||
CCC = xlC_r
|
||||
|
||||
RANLIB = ranlib
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
ARCH := aix
|
||||
CPU_ARCH = rs6000
|
||||
GFX_ARCH = x
|
||||
INLINES = js_compare_and_swap:js_fast_lock1:js_fast_unlock1:js_lock_get_slot:js_lock_set_slot:js_lock_scope1
|
||||
|
||||
OS_CFLAGS = -qarch=com -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV
|
||||
OS_LIBS = -lbsd -lsvld -lm
|
||||
#-lpthreads -lc_r
|
||||
|
||||
37
mozilla/js/src/config/AIX4.2.mk
Normal file
37
mozilla/js/src/config/AIX4.2.mk
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for AIX
|
||||
#
|
||||
|
||||
CC = xlC_r
|
||||
CCC = xlC_r
|
||||
|
||||
RANLIB = ranlib
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
ARCH := aix
|
||||
CPU_ARCH = rs6000
|
||||
GFX_ARCH = x
|
||||
INLINES = js_compare_and_swap:js_fast_lock1:js_fast_unlock1:js_lock_get_slot:js_lock_set_slot:js_lock_scope1
|
||||
|
||||
OS_CFLAGS = -qarch=com -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV
|
||||
OS_LIBS = -lbsd -lsvld -lm
|
||||
#-lpthreads -lc_r
|
||||
|
||||
48
mozilla/js/src/config/HP-UXB.10.10.mk
Normal file
48
mozilla/js/src/config/HP-UXB.10.10.mk
Normal file
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for HPUX
|
||||
#
|
||||
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
|
||||
RANLIB = echo
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
|
||||
CPU_ARCH = hppa
|
||||
GFX_ARCH = x
|
||||
|
||||
OS_CFLAGS = -DXP_UNIX -DHPUX -DSYSV -D_SVID_GETTOD
|
||||
OS_LIBS = -ldld
|
||||
|
||||
ifeq ($(OS_RELEASE),B.10)
|
||||
PLATFORM_FLAGS += -DHPUX10 -Dhpux10
|
||||
PORT_FLAGS += -DRW_NO_OVERLOAD_SCHAR -DHAVE_MODEL_H
|
||||
ifeq ($(OS_VERSION),.10)
|
||||
PLATFORM_FLAGS += -DHPUX10_10
|
||||
endif
|
||||
ifeq ($(OS_VERSION),.20)
|
||||
PLATFORM_FLAGS += -DHPUX10_20
|
||||
endif
|
||||
ifeq ($(OS_VERSION),.30)
|
||||
PLATFORM_FLAGS += -DHPUX10_30
|
||||
endif
|
||||
endif
|
||||
48
mozilla/js/src/config/HP-UXB.11.00.mk
Normal file
48
mozilla/js/src/config/HP-UXB.11.00.mk
Normal file
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for HPUX
|
||||
#
|
||||
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
|
||||
RANLIB = echo
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
|
||||
CPU_ARCH = hppa
|
||||
GFX_ARCH = x
|
||||
|
||||
OS_CFLAGS = -DXP_UNIX -DHPUX -DSYSV -D_SVID_GETTOD
|
||||
OS_LIBS = -ldld
|
||||
|
||||
ifeq ($(OS_RELEASE),B.10)
|
||||
PLATFORM_FLAGS += -DHPUX10 -Dhpux10
|
||||
PORT_FLAGS += -DRW_NO_OVERLOAD_SCHAR -DHAVE_MODEL_H
|
||||
ifeq ($(OS_VERSION),.10)
|
||||
PLATFORM_FLAGS += -DHPUX10_10
|
||||
endif
|
||||
ifeq ($(OS_VERSION),.20)
|
||||
PLATFORM_FLAGS += -DHPUX10_20
|
||||
endif
|
||||
ifeq ($(OS_VERSION),.30)
|
||||
PLATFORM_FLAGS += -DHPUX10_30
|
||||
endif
|
||||
endif
|
||||
58
mozilla/js/src/config/IRIX.mk
Normal file
58
mozilla/js/src/config/IRIX.mk
Normal file
@@ -0,0 +1,58 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for IRIX
|
||||
#
|
||||
|
||||
CPU_ARCH = mips
|
||||
GFX_ARCH = x
|
||||
|
||||
RANLIB = /bin/true
|
||||
|
||||
#NS_USE_GCC = 1
|
||||
|
||||
ifdef NS_USE_GCC
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
AS = $(CC) -x assembler-with-cpp
|
||||
ODD_CFLAGS = -Wall -Wno-format
|
||||
ifdef BUILD_OPT
|
||||
OPTIMIZER = -O6
|
||||
endif
|
||||
else
|
||||
ifeq ($(OS_RELEASE),6.2)
|
||||
CC = cc -32 -DIRIX6_2
|
||||
endif
|
||||
ifeq ($(OS_RELEASE),6.3)
|
||||
CC = cc -32 -DIRIX6_3
|
||||
endif
|
||||
CCC = CC
|
||||
ODD_CFLAGS = -fullwarn -xansi
|
||||
ifdef BUILD_OPT
|
||||
OPTIMIZER += -Olimit 4000
|
||||
endif
|
||||
endif
|
||||
|
||||
# For purify
|
||||
HAVE_PURIFY = 1
|
||||
PURE_OS_CFLAGS = $(ODD_CFLAGS) -DXP_UNIX -DSVR4 -DSW_THREADS -DIRIX
|
||||
|
||||
OS_CFLAGS = $(PURE_OS_CFLAGS) -MDupdate $(DEPENDENCIES)
|
||||
|
||||
BSDECHO = echo
|
||||
MKSHLIB = $(LD) -shared
|
||||
22
mozilla/js/src/config/IRIX5.3.mk
Normal file
22
mozilla/js/src/config/IRIX5.3.mk
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for IRIX5.3
|
||||
#
|
||||
|
||||
include config/IRIX.mk
|
||||
22
mozilla/js/src/config/IRIX6.1.mk
Normal file
22
mozilla/js/src/config/IRIX6.1.mk
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for IRIX6.3
|
||||
#
|
||||
|
||||
include config/IRIX.mk
|
||||
22
mozilla/js/src/config/IRIX6.2.mk
Normal file
22
mozilla/js/src/config/IRIX6.2.mk
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for IRIX6.2
|
||||
#
|
||||
|
||||
include config/IRIX.mk
|
||||
22
mozilla/js/src/config/IRIX6.3.mk
Normal file
22
mozilla/js/src/config/IRIX6.3.mk
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for IRIX6.3
|
||||
#
|
||||
|
||||
include config/IRIX.mk
|
||||
47
mozilla/js/src/config/Linux_All.mk
Normal file
47
mozilla/js/src/config/Linux_All.mk
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config for all versions of Linux
|
||||
#
|
||||
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
|
||||
RANLIB = echo
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
|
||||
CPU_ARCH = $(shell uname -m)
|
||||
ifeq (86,$(findstring 86,$(CPU_ARCH)))
|
||||
CPU_ARCH = x86
|
||||
endif
|
||||
GFX_ARCH = x
|
||||
|
||||
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DLINUX
|
||||
OS_LIBS = -lm -lc
|
||||
|
||||
ASFLAGS += -x assembler-with-cpp
|
||||
|
||||
ifeq ($(CPU_ARCH),alpha)
|
||||
|
||||
# Ask the C compiler on alpha linux to let us work with denormalized
|
||||
# double values, which are required by the ECMA spec.
|
||||
|
||||
OS_CFLAGS += -mieee
|
||||
endif
|
||||
79
mozilla/js/src/config/SunOS4.1.4.mk
Normal file
79
mozilla/js/src/config/SunOS4.1.4.mk
Normal file
@@ -0,0 +1,79 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for SunOS4.1
|
||||
#
|
||||
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
RANLIB = ranlib
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
|
||||
CPU_ARCH = sparc
|
||||
GFX_ARCH = x
|
||||
|
||||
# A pile of -D's to build xfe on sunos
|
||||
MOZ_CFLAGS = -DSTRINGS_ALIGNED -DNO_REGEX -DNO_ISDIR -DUSE_RE_COMP \
|
||||
-DNO_REGCOMP -DUSE_GETWD -DNO_MEMMOVE -DNO_ALLOCA \
|
||||
-DBOGUS_MB_MAX -DNO_CONST
|
||||
|
||||
# Purify doesn't like -MDupdate
|
||||
NOMD_OS_CFLAGS = -DXP_UNIX -Wall -Wno-format -DSW_THREADS -DSUNOS4 -DNEED_SYSCALL \
|
||||
$(MOZ_CFLAGS)
|
||||
|
||||
OS_CFLAGS = $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES)
|
||||
OS_LIBS = -ldl -lm
|
||||
|
||||
MKSHLIB = $(LD) -L$(MOTIF)/lib
|
||||
|
||||
HAVE_PURIFY = 1
|
||||
MOTIF = /home/motif/usr
|
||||
MOTIFLIB = -L$(MOTIF)/lib -lXm
|
||||
INCLUDES += -I/usr/X11R5/include -I$(MOTIF)/include
|
||||
|
||||
NOSUCHFILE = /solaris-rm-f-sucks
|
||||
|
||||
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/sunos.lm
|
||||
|
||||
EN_LOCALE = en_US
|
||||
DE_LOCALE = de
|
||||
FR_LOCALE = fr
|
||||
JP_LOCALE = ja
|
||||
SJIS_LOCALE = ja_JP.SJIS
|
||||
KR_LOCALE = ko
|
||||
CN_LOCALE = zh
|
||||
TW_LOCALE = zh_TW
|
||||
I2_LOCALE = i2
|
||||
IT_LOCALE = it
|
||||
SV_LOCALE = sv
|
||||
ES_LOCALE = es
|
||||
NL_LOCALE = nl
|
||||
PT_LOCALE = pt
|
||||
|
||||
LOC_LIB_DIR = /usr/openwin/lib/locale
|
||||
|
||||
BSDECHO = echo
|
||||
|
||||
#
|
||||
# These defines are for building unix plugins
|
||||
#
|
||||
BUILD_UNIX_PLUGINS = 1
|
||||
DSO_LDOPTS =
|
||||
DSO_LDFLAGS =
|
||||
66
mozilla/js/src/config/SunOS5.3.mk
Normal file
66
mozilla/js/src/config/SunOS5.3.mk
Normal file
@@ -0,0 +1,66 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for SunOS5.3
|
||||
#
|
||||
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
|
||||
#CC = /opt/SUNWspro/SC3.0.1/bin/cc
|
||||
RANLIB = echo
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
|
||||
CPU_ARCH = sparc
|
||||
GFX_ARCH = x
|
||||
|
||||
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS
|
||||
OS_LIBS = -lsocket -lnsl -ldl
|
||||
|
||||
ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0
|
||||
|
||||
HAVE_PURIFY = 1
|
||||
|
||||
NOSUCHFILE = /solaris-rm-f-sucks
|
||||
|
||||
ifndef JS_NO_ULTRA
|
||||
ULTRA_OPTIONS := -xarch=v8plus
|
||||
ULTRA_OPTIONSD := -DULTRA_SPARC
|
||||
else
|
||||
ULTRA_OPTIONS := -xarch=v8
|
||||
ULTRA_OPTIONSD :=
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4u)
|
||||
DEFINES += $(ULTRA_OPTIONSD)
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD)
|
||||
else
|
||||
ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4m)
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,-xarch=v8
|
||||
else
|
||||
ASFLAGS += -xarch=v8
|
||||
endif
|
||||
endif
|
||||
67
mozilla/js/src/config/SunOS5.4.mk
Normal file
67
mozilla/js/src/config/SunOS5.4.mk
Normal file
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for SunOS5.4
|
||||
#
|
||||
|
||||
ifdef NS_USE_NATIVE
|
||||
CC = cc
|
||||
CCC = CC
|
||||
else
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
endif
|
||||
|
||||
RANLIB = echo
|
||||
|
||||
CPU_ARCH = sparc
|
||||
GFX_ARCH = x
|
||||
|
||||
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D__svr4 -DSOLARIS
|
||||
OS_LIBS = -lsocket -lnsl -ldl
|
||||
|
||||
ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0
|
||||
|
||||
HAVE_PURIFY = 1
|
||||
|
||||
NOSUCHFILE = /solaris-rm-f-sucks
|
||||
|
||||
ifndef JS_NO_ULTRA
|
||||
ULTRA_OPTIONS := -xarch=v8plus
|
||||
ULTRA_OPTIONSD := -DULTRA_SPARC
|
||||
else
|
||||
ULTRA_OPTIONS := -xarch=v8
|
||||
ULTRA_OPTIONSD :=
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4u)
|
||||
DEFINES += $(ULTRA_OPTIONSD)
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD)
|
||||
else
|
||||
ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4m)
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,-xarch=v8
|
||||
else
|
||||
ASFLAGS += -xarch=v8
|
||||
endif
|
||||
endif
|
||||
71
mozilla/js/src/config/SunOS5.5.1.mk
Normal file
71
mozilla/js/src/config/SunOS5.5.1.mk
Normal file
@@ -0,0 +1,71 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for SunOS5.5
|
||||
#
|
||||
|
||||
AS = as
|
||||
ifndef NS_USE_NATIVE
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall
|
||||
else
|
||||
CC = cc
|
||||
CCC = CC
|
||||
endif
|
||||
|
||||
RANLIB = echo
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
|
||||
CPU_ARCH = sparc
|
||||
GFX_ARCH = x
|
||||
|
||||
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -D_SVID_GETTOD
|
||||
OS_LIBS = -lsocket -lnsl -ldl
|
||||
|
||||
ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0
|
||||
|
||||
HAVE_PURIFY = 1
|
||||
|
||||
NOSUCHFILE = /solaris-rm-f-sucks
|
||||
|
||||
ifndef JS_NO_ULTRA
|
||||
ULTRA_OPTIONS := -xarch=v8plus
|
||||
ULTRA_OPTIONSD := -DULTRA_SPARC
|
||||
else
|
||||
ULTRA_OPTIONS := -xarch=v8
|
||||
ULTRA_OPTIONSD :=
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4u)
|
||||
DEFINES += $(ULTRA_OPTIONSD)
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD)
|
||||
else
|
||||
ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4m)
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,-xarch=v8
|
||||
else
|
||||
ASFLAGS += -xarch=v8
|
||||
endif
|
||||
endif
|
||||
62
mozilla/js/src/config/SunOS5.5.mk
Normal file
62
mozilla/js/src/config/SunOS5.5.mk
Normal file
@@ -0,0 +1,62 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for SunOS5.5
|
||||
#
|
||||
|
||||
AS = as
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
|
||||
#CC = /opt/SUNWspro/SC3.0.1/bin/cc
|
||||
RANLIB = echo
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
|
||||
CPU_ARCH = sparc
|
||||
GFX_ARCH = x
|
||||
|
||||
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -D_SVID_GETTOD
|
||||
OS_LIBS = -lsocket -lnsl -ldl
|
||||
|
||||
ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0
|
||||
|
||||
HAVE_PURIFY = 1
|
||||
|
||||
NOSUCHFILE = /solaris-rm-f-sucks
|
||||
|
||||
ifndef JS_NO_ULTRA
|
||||
ULTRA_OPTIONS := -xarch=v8plus -DULTRA_SPARC
|
||||
else
|
||||
ULTRA_OPTIONS := -xarch=v8
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4u)
|
||||
ASFLAGS += $(ULTRA_OPTIONS)
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,$(ULTRA_OPTIONS)
|
||||
endif
|
||||
else
|
||||
ifeq ($(OS_CPUARCH),sun4m)
|
||||
ASFLAGS += -xarch=v8
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,-xarch=v8
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
46
mozilla/js/src/config/WINNT4.0.mk
Normal file
46
mozilla/js/src/config/WINNT4.0.mk
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
#
|
||||
# Config for Windows NT using MS Visual C++ (version?)
|
||||
#
|
||||
|
||||
CC = cl
|
||||
|
||||
RANLIB = echo
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
|
||||
CPU_ARCH = x86 # XXX fixme
|
||||
GFX_ARCH = win32
|
||||
|
||||
OS_CFLAGS = -DXP_PC -DWIN32 -D_WINDOWS -D_WIN32
|
||||
OS_LIBS = -lm -lc
|
||||
|
||||
PREBUILT_CPUCFG = 1
|
||||
USE_MSVC = 1
|
||||
|
||||
LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib /nologo\
|
||||
/subsystem:windows /dll /incremental:yes /debug\
|
||||
/machine:I386
|
||||
|
||||
CAFEDIR = t:/cafe
|
||||
JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip
|
||||
JAVAC = $(CAFEDIR)/Bin/sj.exe
|
||||
JAVAH = $(CAFEDIR)/Java/Bin/javah.exe
|
||||
JCFLAGS = -I$(CAFEDIR)/Java/Include -I$(CAFEDIR)/Java/Include/win32
|
||||
42
mozilla/js/src/config/dgux.mk
Normal file
42
mozilla/js/src/config/dgux.mk
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for Data General DG/UX
|
||||
#
|
||||
|
||||
#
|
||||
# Initial DG/UX port by Marc Fraioli (fraioli@dg-rtp.dg.com)
|
||||
#
|
||||
|
||||
AS = as
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
|
||||
RANLIB = echo
|
||||
|
||||
#
|
||||
# _DGUX_SOURCE is needed to turn on a lot of stuff in the headers if
|
||||
# you're not using DG's compiler. It shouldn't hurt if you are.
|
||||
#
|
||||
# _POSIX4A_DRAFT10_SOURCE is needed to pick up localtime_r, used in
|
||||
# prtime.c
|
||||
#
|
||||
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DDGUX -D_DGUX_SOURCE -D_POSIX4A_DRAFT10_SOURCE
|
||||
OS_LIBS = -lsocket -lnsl
|
||||
|
||||
NOSUCHFILE = /no-such-file
|
||||
30
mozilla/js/src/export.mac
Normal file
30
mozilla/js/src/export.mac
Normal file
@@ -0,0 +1,30 @@
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
jsapi.h
|
||||
jsarray.h
|
||||
jsatom.h
|
||||
jsbool.h
|
||||
jscntxt.h
|
||||
jscompat.h
|
||||
jsconfig.h
|
||||
jsdate.h
|
||||
jsdbgapi.h
|
||||
jsemit.h
|
||||
jsfun.h
|
||||
jsgc.h
|
||||
jsinterp.h
|
||||
jslock.h
|
||||
jsmath.h
|
||||
jsnum.h
|
||||
jsobj.h
|
||||
jsopcode.def
|
||||
jsopcode.h
|
||||
jsparse.h
|
||||
jsprvtd.h
|
||||
jspubtd.h
|
||||
jsregexp.h
|
||||
jsscan.h
|
||||
jsscope.h
|
||||
jsscript.h
|
||||
jsstr.h
|
||||
1545
mozilla/js/src/js.c
Normal file
1545
mozilla/js/src/js.c
Normal file
File diff suppressed because it is too large
Load Diff
184
mozilla/js/src/js.dsp
Normal file
184
mozilla/js/src/js.dsp
Normal file
@@ -0,0 +1,184 @@
|
||||
# Microsoft Developer Studio Project File - Name="jsshell" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=jsshell - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "js.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "js.mak" CFG="jsshell - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "jsshell - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "jsshell - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "jsshell - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir ".\jsshell_"
|
||||
# PROP BASE Intermediate_Dir ".\jsshell_"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ".\Release"
|
||||
# PROP Intermediate_Dir ".\Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "mininspr" /D "NDEBUG" /D "_CONSOLE" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "_WINDOWS" /D "JSFILE" /D "MINI_NSPR" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:".\Release\jsshell.exe"
|
||||
|
||||
!ELSEIF "$(CFG)" == "jsshell - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir ".\jsshell0"
|
||||
# PROP BASE Intermediate_Dir ".\jsshell0"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ".\Debug"
|
||||
# PROP Intermediate_Dir ".\Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "mininspr" /D "_DEBUG" /D "DEBUG" /D "_CONSOLE" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "_WINDOWS" /D "JSFILE" /D "MINI_NSPR" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:".\Debug\jsshell.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "jsshell - Win32 Release"
|
||||
# Name "jsshell - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\js.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsapi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsatom.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jscntxt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsdbgapi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsemit.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsfun.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsgc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsinterp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jslock.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsobj.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsopcode.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsparse.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsprvtd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jspubtd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsregexp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscan.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscope.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscript.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsstddef.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsstr.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prarena.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
56
mozilla/js/src/js.dsw
Normal file
56
mozilla/js/src/js.dsw
Normal file
@@ -0,0 +1,56 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 5.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "js32"=.\js32.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "jsshell"=.\js.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name js32
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "miniNSPR"=.\miniNSPR.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
3756
mozilla/js/src/js.mak
Normal file
3756
mozilla/js/src/js.mak
Normal file
File diff suppressed because it is too large
Load Diff
BIN
mozilla/js/src/js.mdp
Normal file
BIN
mozilla/js/src/js.mdp
Normal file
Binary file not shown.
194
mozilla/js/src/js.msg
Normal file
194
mozilla/js/src/js.msg
Normal file
@@ -0,0 +1,194 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is the JavaScript error message file.
|
||||
|
||||
The format for each JS error message is:
|
||||
|
||||
MSG_DEF(<SYMBOLIC_NAME>, <ERROR_NUMBER>, <ARGUMENT_COUNT>, <EXCEPTION_NAME>,
|
||||
<FORMAT_STRING>)
|
||||
|
||||
where ;
|
||||
<SYMBOLIC_NAME> is a legal C identifer that will be used in the
|
||||
JS engine source.
|
||||
|
||||
<ERROR_NUMBER> is an unique integral value identifying this error.
|
||||
|
||||
<ARGUMENT_COUNT> is an integer literal specifying the total number of
|
||||
replaceable arguments in the following format string.
|
||||
|
||||
<EXCEPTION_NAME> is an exception index from the enum in jsexn.c;
|
||||
JSEXN_NONE for none. The given exception index will be raised by the
|
||||
engine when the corresponding error occurs.
|
||||
|
||||
<FORMAT_STRING> is a string literal, optionally containing sequences
|
||||
{X} where X is an integer representing the argument number that will
|
||||
be replaced with a string value when the error is reported.
|
||||
|
||||
e.g.
|
||||
|
||||
MSG_DEF(JSMSG_NOT_A_SUBSPECIES, 73, JSEXN_NONE, 2,
|
||||
"{0} is not a member of the {1} family")
|
||||
|
||||
can be used :
|
||||
|
||||
JS_ReportErrorNumber(JSMSG_NOT_A_SUBSPECIES, "Rhino", "Monkey");
|
||||
|
||||
to report :
|
||||
|
||||
"Rhino is not a member of the Monkey family"
|
||||
|
||||
*/
|
||||
|
||||
MSG_DEF(JSMSG_NOT_AN_ERROR, 0, 0, JSEXN_NONE, "<Error #0 is reserved>")
|
||||
MSG_DEF(JSMSG_NOT_DEFINED, 1, 1, JSEXN_REFERENCEERR, "{0} is not defined")
|
||||
MSG_DEF(JSMSG_NO_REG_EXPS, 2, 1, JSEXN_INTERNALERR, "sorry, regular expression are not supported")
|
||||
MSG_DEF(JSMSG_MORE_ARGS_NEEDED, 3, 3, JSEXN_NONE, "{0} requires more than {1} argument{2}")
|
||||
MSG_DEF(JSMSG_BAD_CHAR, 4, 1, JSEXN_NONE, "invalid format character {0}")
|
||||
MSG_DEF(JSMSG_BAD_TYPE, 5, 1, JSEXN_NONE, "unknown type {0}")
|
||||
MSG_DEF(JSMSG_CANT_LOCK, 6, 0, JSEXN_NONE, "can't lock memory")
|
||||
MSG_DEF(JSMSG_CANT_UNLOCK, 7, 0, JSEXN_NONE, "can't unlock memory")
|
||||
MSG_DEF(JSMSG_INCOMPATIBLE_PROTO, 8, 3, JSEXN_TARGETERR, "{0}.prototype.{1} called on incompatible {2}")
|
||||
MSG_DEF(JSMSG_NO_CONSTRUCTOR, 9, 1, JSEXN_NONE, "{0} has no constructor")
|
||||
MSG_DEF(JSMSG_CANT_ALIAS, 10, 3, JSEXN_NONE, "can't alias {0} to {1} in class {2}")
|
||||
MSG_DEF(JSMSG_NO_PROTO, 11, 1, JSEXN_INTERNALERR, "sorry, Array.prototype.{0} is not yet implemented")
|
||||
MSG_DEF(JSMSG_BAD_SORT_ARG, 12, 0, JSEXN_ARRAYERR, "invalid Array.prototype.sort argument")
|
||||
MSG_DEF(JSMSG_BAD_ATOMIC_NUMBER, 13, 1, JSEXN_INTERNALERR, "internal error: no index for atom {0}")
|
||||
MSG_DEF(JSMSG_TOO_MANY_LITERALS, 14, 0, JSEXN_INTERNALERR, "too many literals")
|
||||
MSG_DEF(JSMSG_CANT_WATCH, 15, 1, JSEXN_NONE, "can't watch non-native objects of class {0}")
|
||||
MSG_DEF(JSMSG_STACK_UNDERFLOW, 16, 2, JSEXN_INTERNALERR, "internal error compiling {0}: stack underflow at pc {1}")
|
||||
MSG_DEF(JSMSG_NEED_DIET, 17, 1, JSEXN_SYNTAXERR, "{0} too large")
|
||||
MSG_DEF(JSMSG_BAD_CASE, 18, 2, JSEXN_SYNTAXERR, "{0}, line {1}: invalid case expression")
|
||||
MSG_DEF(JSMSG_READ_ONLY, 19, 1, JSEXN_ERR, "{0} is read-only")
|
||||
MSG_DEF(JSMSG_BAD_FORMAL, 20, 0, JSEXN_SYNTAXERR, "malformed formal parameter")
|
||||
MSG_DEF(JSMSG_SAME_FORMAL, 21, 1, JSEXN_NONE, "duplicate formal argument {0}")
|
||||
MSG_DEF(JSMSG_NOT_FUNCTION, 22, 1, JSEXN_CALLERR, "{0} is not a function")
|
||||
MSG_DEF(JSMSG_NOT_CONSTRUCTOR, 23, 1, JSEXN_CONSTRUCTORERR, "{0} is not a constructor")
|
||||
MSG_DEF(JSMSG_STACK_OVERFLOW, 24, 1, JSEXN_NONE, "stack overflow in {0}")
|
||||
MSG_DEF(JSMSG_NOT_EXPORTED, 25, 1, JSEXN_NONE, "{0} is not exported")
|
||||
MSG_DEF(JSMSG_OVER_RECURSED, 26, 0, JSEXN_NONE, "too much recursion")
|
||||
MSG_DEF(JSMSG_IN_NOT_OBJECT, 27, 0, JSEXN_ERR, "target of 'in' operator must be an object")
|
||||
MSG_DEF(JSMSG_BAD_NEW_RESULT, 28, 1, JSEXN_NONE, "invalid new expression result {0}")
|
||||
MSG_DEF(JSMSG_BAD_SHARP_DEF, 29, 1, JSEXN_ERR, "invalid sharp variable definition #{0}=")
|
||||
MSG_DEF(JSMSG_BAD_SHARP_USE, 30, 1, JSEXN_ERR, "invalid sharp variable use #{0}#")
|
||||
MSG_DEF(JSMSG_BAD_INSTANCEOF_RHS, 31, 1, JSEXN_ERR, "invalid instanceof operand {0}")
|
||||
MSG_DEF(JSMSG_BAD_BYTECODE, 32, 1, JSEXN_INTERNALERR, "unimplemented JavaScript bytecode {0}")
|
||||
MSG_DEF(JSMSG_BAD_RADIX, 33, 1, JSEXN_ERR, "illegal radix {0}")
|
||||
MSG_DEF(JSMSG_NAN, 34, 1, JSEXN_ERR, "{0} is not a number")
|
||||
MSG_DEF(JSMSG_CANT_CONVERT, 35, 1, JSEXN_TOPRIMITIVEERR, "can't convert {0} to an integer")
|
||||
MSG_DEF(JSMSG_CYCLIC_VALUE, 36, 1, JSEXN_ERR, "cyclic {0} value")
|
||||
MSG_DEF(JSMSG_PERMANENT, 37, 1, JSEXN_ERR, "{0} is permanent")
|
||||
MSG_DEF(JSMSG_CANT_CONVERT_TO, 38, 2, JSEXN_DEFAULTVALUEERR, "can't convert {0} to {1}")
|
||||
MSG_DEF(JSMSG_NO_PROPERTIES, 39, 1, JSEXN_TOOBJECTERR, "{0} has no properties")
|
||||
MSG_DEF(JSMSG_CANT_FIND_CLASS, 40, 1, JSEXN_NONE, "can't find class id {0}")
|
||||
MSG_DEF(JSMSG_CANT_XDR_CLASS, 41, 1, JSEXN_NONE, "can't XDR class {0}")
|
||||
MSG_DEF(JSMSG_BYTECODE_TOO_BIG, 42, 2, JSEXN_INTERNALERR, "bytecode {0} too large (limit {1})")
|
||||
MSG_DEF(JSMSG_UNKNOWN_FORMAT, 43, 1, JSEXN_INTERNALERR, "unknown bytecode format {0}")
|
||||
MSG_DEF(JSMSG_TOO_MANY_CON_ARGS, 44, 0, JSEXN_SYNTAXERR, "too many constructor arguments")
|
||||
MSG_DEF(JSMSG_TOO_MANY_FUN_ARGS, 45, 0, JSEXN_SYNTAXERR, "too many function arguments")
|
||||
MSG_DEF(JSMSG_BAD_QUANTIFIER, 46, 1, JSEXN_SYNTAXERR, "invalid quantifier {0}")
|
||||
MSG_DEF(JSMSG_MIN_TOO_BIG, 47, 1, JSEXN_SYNTAXERR, "overlarge minimum {0}")
|
||||
MSG_DEF(JSMSG_MAX_TOO_BIG, 48, 1, JSEXN_SYNTAXERR, "overlarge maximum {0}")
|
||||
MSG_DEF(JSMSG_OUT_OF_ORDER, 49, 1, JSEXN_SYNTAXERR, "maximum {0} less than minimum")
|
||||
MSG_DEF(JSMSG_ZERO_QUANTIFIER, 50, 1, JSEXN_SYNTAXERR, "zero quantifier {0}")
|
||||
MSG_DEF(JSMSG_UNTERM_QUANTIFIER, 51, 1, JSEXN_SYNTAXERR, "unterminated quantifier {0}")
|
||||
MSG_DEF(JSMSG_EMPTY_BEFORE_STAR, 52, 0, JSEXN_SYNTAXERR, "regular expression before * could be empty")
|
||||
MSG_DEF(JSMSG_EMPTY_BEFORE_PLUS, 53, 0, JSEXN_SYNTAXERR, "regular expression before + could be empty")
|
||||
MSG_DEF(JSMSG_MISSING_PAREN, 54, 1, JSEXN_SYNTAXERR, "unterminated parenthetical {0}")
|
||||
MSG_DEF(JSMSG_UNTERM_CLASS, 55, 1, JSEXN_SYNTAXERR, "unterminated character class {0}")
|
||||
MSG_DEF(JSMSG_TRAILING_SLASH, 56, 0, JSEXN_SYNTAXERR, "trailing \\ in regular expression")
|
||||
MSG_DEF(JSMSG_BAD_CLASS_RANGE, 57, 0, JSEXN_SYNTAXERR, "invalid range in character class")
|
||||
MSG_DEF(JSMSG_BAD_FLAG, 58, 1, JSEXN_SYNTAXERR, "invalid regular expression flag {0}")
|
||||
MSG_DEF(JSMSG_NO_INPUT, 59, 3, JSEXN_SYNTAXERR, "no input for /{0}/{1}{2}")
|
||||
MSG_DEF(JSMSG_CANT_OPEN, 60, 2, JSEXN_NONE, "can't open {0}: {1}")
|
||||
MSG_DEF(JSMSG_BAD_STRING_MASK, 61, 1, JSEXN_ERR, "invalid string escape mask {0}")
|
||||
MSG_DEF(JSMSG_NO_STRING_PROTO, 62, 1, JSEXN_INTERNALERR, "sorry, String.prototype.{0} is not yet implemented")
|
||||
MSG_DEF(JSMSG_END_OF_DATA, 63, 0, JSEXN_NONE, "unexpected end of data")
|
||||
MSG_DEF(JSMSG_SEEK_BEYOND_START, 64, 0, JSEXN_NONE, "illegal seek beyond start")
|
||||
MSG_DEF(JSMSG_SEEK_BEYOND_END, 65, 0, JSEXN_NONE, "illegal seek beyond end")
|
||||
MSG_DEF(JSMSG_END_SEEK, 66, 0, JSEXN_NONE, "illegal end-based seek")
|
||||
MSG_DEF(JSMSG_WHITHER_WHENCE, 67, 1, JSEXN_NONE, "unknown seek whence: {0}")
|
||||
MSG_DEF(JSMSG_BAD_JVAL_TYPE, 68, 1, JSEXN_NONE, "unknown jsval type {0} for XDR")
|
||||
MSG_DEF(JSMSG_PAREN_BEFORE_FORMAL, 69, 0, JSEXN_SYNTAXERR, "missing ( before formal parameters")
|
||||
MSG_DEF(JSMSG_MISSING_FORMAL, 70, 0, JSEXN_SYNTAXERR, "missing formal parameter")
|
||||
MSG_DEF(JSMSG_PAREN_AFTER_FORMAL, 71, 0, JSEXN_SYNTAXERR, "missing ) after formal parameters")
|
||||
MSG_DEF(JSMSG_CURLY_BEFORE_BODY, 72, 0, JSEXN_SYNTAXERR, "missing { before function body")
|
||||
MSG_DEF(JSMSG_CURLY_AFTER_BODY, 73, 0, JSEXN_SYNTAXERR, "missing } after function body")
|
||||
MSG_DEF(JSMSG_PAREN_BEFORE_COND, 74, 0, JSEXN_SYNTAXERR, "missing ( before condition")
|
||||
MSG_DEF(JSMSG_PAREN_AFTER_COND, 75, 0, JSEXN_SYNTAXERR, "missing ) after condition")
|
||||
MSG_DEF(JSMSG_NO_IMPORT_NAME, 76, 0, JSEXN_SYNTAXERR, "missing name in import statement")
|
||||
MSG_DEF(JSMSG_NAME_AFTER_DOT, 77, 0, JSEXN_SYNTAXERR, "missing name after . operator")
|
||||
MSG_DEF(JSMSG_BRACKET_IN_INDEX, 78, 0, JSEXN_SYNTAXERR, "missing ] in index expression")
|
||||
MSG_DEF(JSMSG_NO_EXPORT_NAME, 79, 0, JSEXN_SYNTAXERR, "missing name in export statement")
|
||||
MSG_DEF(JSMSG_PAREN_BEFORE_SWITCH, 80, 0, JSEXN_SYNTAXERR, "missing ( before switch expression")
|
||||
MSG_DEF(JSMSG_PAREN_AFTER_SWITCH, 81, 0, JSEXN_SYNTAXERR, "missing ) after switch expression")
|
||||
MSG_DEF(JSMSG_CURLY_BEFORE_SWITCH, 82, 0, JSEXN_SYNTAXERR, "missing { before switch body")
|
||||
MSG_DEF(JSMSG_COLON_AFTER_CASE, 83, 0, JSEXN_SYNTAXERR, "missing : after case label")
|
||||
MSG_DEF(JSMSG_WHILE_AFTER_DO, 84, 0, JSEXN_SYNTAXERR, "missing while after do-loop body")
|
||||
MSG_DEF(JSMSG_PAREN_AFTER_FOR, 85, 0, JSEXN_SYNTAXERR, "missing ( after for")
|
||||
MSG_DEF(JSMSG_SEMI_AFTER_FOR_INIT, 86, 0, JSEXN_SYNTAXERR, "missing ; after for-loop initializer")
|
||||
MSG_DEF(JSMSG_SEMI_AFTER_FOR_COND, 87, 0, JSEXN_SYNTAXERR, "missing ; after for-loop condition")
|
||||
MSG_DEF(JSMSG_PAREN_AFTER_FOR_CTRL, 88, 0, JSEXN_SYNTAXERR, "missing ) after for-loop control")
|
||||
MSG_DEF(JSMSG_CURLY_BEFORE_TRY, 89, 0, JSEXN_SYNTAXERR, "missing { before try block")
|
||||
MSG_DEF(JSMSG_CURLY_AFTER_TRY, 90, 0, JSEXN_SYNTAXERR, "missing } after try block")
|
||||
MSG_DEF(JSMSG_PAREN_BEFORE_CATCH, 91, 0, JSEXN_SYNTAXERR, "missing ( before catch")
|
||||
MSG_DEF(JSMSG_CATCH_IDENTIFIER, 92, 0, JSEXN_SYNTAXERR, "missing identifier in catch")
|
||||
MSG_DEF(JSMSG_PAREN_AFTER_CATCH, 93, 0, JSEXN_SYNTAXERR, "missing ) after catch")
|
||||
MSG_DEF(JSMSG_CURLY_BEFORE_CATCH, 94, 0, JSEXN_SYNTAXERR, "missing { before catch block")
|
||||
MSG_DEF(JSMSG_CURLY_AFTER_CATCH, 95, 0, JSEXN_SYNTAXERR, "missing } after catch block")
|
||||
MSG_DEF(JSMSG_CURLY_BEFORE_FINALLY, 96, 0, JSEXN_SYNTAXERR, "missing { before finally block")
|
||||
MSG_DEF(JSMSG_CURLY_AFTER_FINALLY, 97, 0, JSEXN_SYNTAXERR, "missing } after finally block")
|
||||
MSG_DEF(JSMSG_CATCH_OR_FINALLY, 98, 0, JSEXN_SYNTAXERR, "missing catch or finally after try")
|
||||
MSG_DEF(JSMSG_PAREN_BEFORE_WITH, 99, 0, JSEXN_SYNTAXERR, "missing ( before with-statement object")
|
||||
MSG_DEF(JSMSG_PAREN_AFTER_WITH, 100, 0, JSEXN_SYNTAXERR, "missing ) after with-statement object")
|
||||
MSG_DEF(JSMSG_CURLY_IN_COMPOUND, 101, 0, JSEXN_SYNTAXERR, "missing } in compound statement")
|
||||
MSG_DEF(JSMSG_NO_VARIABLE_NAME, 102, 0, JSEXN_SYNTAXERR, "missing variable name")
|
||||
MSG_DEF(JSMSG_COLON_IN_COND, 103, 0, JSEXN_SYNTAXERR, "missing : in conditional expression")
|
||||
MSG_DEF(JSMSG_PAREN_AFTER_ARGS, 104, 0, JSEXN_SYNTAXERR, "missing ) after argument list")
|
||||
MSG_DEF(JSMSG_BRACKET_AFTER_LIST, 105, 0, JSEXN_SYNTAXERR, "missing ] after element list")
|
||||
MSG_DEF(JSMSG_COLON_AFTER_ID, 106, 0, JSEXN_SYNTAXERR, "missing : after property id")
|
||||
MSG_DEF(JSMSG_CURLY_AFTER_LIST, 107, 0, JSEXN_SYNTAXERR, "missing } after property list")
|
||||
MSG_DEF(JSMSG_PAREN_IN_PAREN, 108, 0, JSEXN_SYNTAXERR, "missing ) in parenthetical")
|
||||
MSG_DEF(JSMSG_SEMI_BEFORE_STMNT, 109, 0, JSEXN_SYNTAXERR, "missing ; before statement")
|
||||
MSG_DEF(JSMSG_NO_RETURN_VALUE, 110, 0, JSEXN_NONE, "function does not always return a value")
|
||||
MSG_DEF(JSMSG_DUPLICATE_FORMAL, 111, 1, JSEXN_NONE, "duplicate formal argument {0}")
|
||||
MSG_DEF(JSMSG_EQUAL_AS_ASSIGN, 112, 1, JSEXN_NONE, "test for equality (==) mistyped as assignment (=)?{0}")
|
||||
MSG_DEF(JSMSG_BAD_IMPORT, 113, 0, JSEXN_SYNTAXERR, "invalid import expression")
|
||||
MSG_DEF(JSMSG_TOO_MANY_DEFAULTS, 114, 0, JSEXN_SYNTAXERR, "more than one switch default")
|
||||
MSG_DEF(JSMSG_TOO_MANY_CASES, 115, 0, JSEXN_INTERNALERR, "too many switch cases")
|
||||
MSG_DEF(JSMSG_BAD_SWITCH, 116, 0, JSEXN_SYNTAXERR, "invalid switch statement")
|
||||
MSG_DEF(JSMSG_BAD_FOR_LEFTSIDE, 117, 0, JSEXN_SYNTAXERR, "invalid for/in left-hand side")
|
||||
MSG_DEF(JSMSG_CATCH_AFTER_GENERAL, 118, 0, JSEXN_NONE, "catch clause after general catch")
|
||||
MSG_DEF(JSMSG_CATCH_WITHOUT_TRY, 119, 0, JSEXN_SYNTAXERR, "catch without try")
|
||||
MSG_DEF(JSMSG_FINALLY_WITHOUT_TRY, 120, 0, JSEXN_SYNTAXERR, "finally without try")
|
||||
MSG_DEF(JSMSG_LABEL_NOT_FOUND, 121, 0, JSEXN_SYNTAXERR, "label not found")
|
||||
MSG_DEF(JSMSG_TOUGH_BREAK, 122, 0, JSEXN_SYNTAXERR, "invalid break")
|
||||
MSG_DEF(JSMSG_BAD_CONTINUE, 123, 0, JSEXN_SYNTAXERR, "invalid continue")
|
||||
MSG_DEF(JSMSG_BAD_RETURN, 124, 0, JSEXN_SYNTAXERR, "invalid return")
|
||||
MSG_DEF(JSMSG_BAD_LABEL, 125, 0, JSEXN_SYNTAXERR, "invalid label")
|
||||
MSG_DEF(JSMSG_DUPLICATE_LABEL, 126, 0, JSEXN_SYNTAXERR, "duplicate label")
|
||||
MSG_DEF(JSMSG_VAR_HIDES_ARG, 127, 1, JSEXN_NONE, "variable {0} hides argument")
|
||||
MSG_DEF(JSMSG_BAD_VAR_INIT, 128, 0, JSEXN_SYNTAXERR, "invalid variable initialization")
|
||||
MSG_DEF(JSMSG_BAD_LEFTSIDE_OF_ASS, 129, 0, JSEXN_SYNTAXERR, "invalid assignment left-hand side")
|
||||
MSG_DEF(JSMSG_BAD_OPERAND, 130, 1, JSEXN_SYNTAXERR, "invalid {0} operand")
|
||||
MSG_DEF(JSMSG_BAD_PROP_ID, 131, 0, JSEXN_SYNTAXERR, "invalid property id")
|
||||
MSG_DEF(JSMSG_RESERVED_ID, 132, 1, JSEXN_SYNTAXERR, "{0} is a reserved identifier")
|
||||
MSG_DEF(JSMSG_SYNTAX_ERROR, 133, 0, JSEXN_SYNTAXERR, "syntax error")
|
||||
MSG_DEF(JSMSG_BAD_SHARP_VAR_DEF, 134, 0, JSEXN_SYNTAXERR, "invalid sharp variable definition")
|
||||
MSG_DEF(JSMSG_BAD_PROTOTYPE, 135, 1, JSEXN_ERR, "'prototype' property of {0} is not an object")
|
||||
130
mozilla/js/src/js11640.def
Normal file
130
mozilla/js/src/js11640.def
Normal file
@@ -0,0 +1,130 @@
|
||||
; The contents of this file are subject to the Netscape Public License
|
||||
; Version 1.0 (the "NPL"); you may not use this file except in
|
||||
; compliance with the NPL. You may obtain a copy of the NPL at
|
||||
; http://www.mozilla.org/NPL/
|
||||
;
|
||||
; Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
; for the specific language governing rights and limitations under the
|
||||
; NPL.
|
||||
;
|
||||
; The Initial Developer of this code under the NPL is Netscape
|
||||
; Communications Corporation. Portions created by Netscape are
|
||||
; Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
; Reserved.
|
||||
LIBRARY JS1640.DLL
|
||||
EXETYPE WINDOWS
|
||||
PROTMODE
|
||||
|
||||
DESCRIPTION 'Netscape 16-bit JavaScript Library'
|
||||
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE SINGLE
|
||||
|
||||
HEAPSIZE 8192
|
||||
|
||||
EXPORTS
|
||||
WEP @1 RESIDENTNAME NONAME
|
||||
_JS_Init = _JS_Init @2
|
||||
_JS_Finish = _JS_Finish @3
|
||||
_JS_GetNaNValue
|
||||
_JS_GetNegativeInfinityValue
|
||||
_JS_GetPositiveInfinityValue
|
||||
_JS_GetEmptyStringValue
|
||||
_JS_ConvertValue
|
||||
_JS_ValueToObject
|
||||
_JS_ValueToFunction
|
||||
_JS_ValueToString
|
||||
_JS_ValueToNumber
|
||||
_JS_ValueToBoolean
|
||||
_JS_TypeOfValue
|
||||
_JS_GetTypeName
|
||||
_JS_Lock
|
||||
_JS_Unlock
|
||||
_JS_NewContext
|
||||
_JS_DestroyContext
|
||||
_JS_ContextIterator
|
||||
_JS_GetGlobalObject
|
||||
_JS_SetGlobalObject
|
||||
_JS_InitStandardClasses
|
||||
; _JS_GetStaticLink
|
||||
_JS_malloc
|
||||
_JS_realloc
|
||||
_JS_free
|
||||
_JS_strdup
|
||||
_JS_NewDouble
|
||||
_JS_NewDoubleValue
|
||||
_JS_AddRoot
|
||||
_JS_RemoveRoot
|
||||
_JS_LockGCThing
|
||||
_JS_UnlockGCThing
|
||||
_JS_GC
|
||||
_JS_PropertyStub
|
||||
_JS_EnumerateStub
|
||||
_JS_ResolveStub
|
||||
_JS_ConvertStub
|
||||
_JS_FinalizeStub
|
||||
_JS_InitClass
|
||||
_JS_GetClass
|
||||
_JS_InstanceOf
|
||||
_JS_GetPrivate
|
||||
_JS_SetPrivate
|
||||
_JS_GetInstancePrivate
|
||||
_JS_GetPrototype
|
||||
_JS_GetParent
|
||||
_JS_SetParent
|
||||
_JS_GetConstructor
|
||||
_JS_NewObject
|
||||
_JS_DefineObject
|
||||
_JS_DefineConstDoubles
|
||||
_JS_DefineProperties
|
||||
_JS_DefineProperty
|
||||
_JS_DefinePropertyWithTinyId
|
||||
_JS_AliasProperty
|
||||
_JS_LookupProperty
|
||||
_JS_GetProperty
|
||||
_JS_SetProperty
|
||||
_JS_DeleteProperty
|
||||
_JS_NewArrayObject
|
||||
_JS_DefineElement
|
||||
_JS_AliasElement
|
||||
_JS_LookupElement
|
||||
_JS_GetElement
|
||||
_JS_SetElement
|
||||
_JS_DeleteElement
|
||||
_JS_ClearScope
|
||||
_JS_NewFunction
|
||||
_JS_GetFunctionObject
|
||||
_JS_GetFunctionName
|
||||
_JS_DefineFunctions
|
||||
_JS_DefineFunction
|
||||
_JS_CompileScript
|
||||
_JS_DestroyScript
|
||||
_JS_CompileFunction
|
||||
_JS_DecompileScript
|
||||
_JS_DecompileFunction
|
||||
_JS_DecompileFunctionBody
|
||||
_JS_ExecuteScript
|
||||
_JS_EvaluateScript
|
||||
_JS_CallFunction
|
||||
_JS_CallFunctionName
|
||||
_JS_CallFunctionValue
|
||||
_JS_SetBranchCallback
|
||||
_JS_IsRunning
|
||||
_JS_NewString
|
||||
_JS_NewStringCopyN
|
||||
_JS_NewStringCopyZ
|
||||
_JS_InternString
|
||||
_JS_GetStringBytes
|
||||
_JS_GetStringLength
|
||||
_JS_CompareStrings
|
||||
_JS_ReportError
|
||||
_JS_ReportOutOfMemory
|
||||
_JS_SetErrorReporter
|
||||
_JS_NewRegExpObject
|
||||
_JS_SetRegExpInput
|
||||
_JS_ClearRegExpStatics
|
||||
|
||||
IMPORTS
|
||||
_printf = nspr21.11
|
||||
_strftime = nspr21.13
|
||||
137
mozilla/js/src/js1640.def
Normal file
137
mozilla/js/src/js1640.def
Normal file
@@ -0,0 +1,137 @@
|
||||
LIBRARY JS1640.DLL
|
||||
EXETYPE WINDOWS
|
||||
PROTMODE
|
||||
|
||||
DESCRIPTION 'Netscape 16-bit JavaScript Library'
|
||||
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE SINGLE
|
||||
|
||||
HEAPSIZE 8192
|
||||
|
||||
EXPORTS
|
||||
WEP @1 RESIDENTNAME NONAME
|
||||
_JS_Init = _JS_Init @2
|
||||
_JS_Finish = _JS_Finish @3
|
||||
_JS_GetNaNValue
|
||||
_JS_GetNegativeInfinityValue
|
||||
_JS_GetPositiveInfinityValue
|
||||
_JS_GetEmptyStringValue
|
||||
_JS_ConvertValue
|
||||
_JS_ValueToObject
|
||||
_JS_ValueToFunction
|
||||
_JS_ValueToString
|
||||
_JS_ValueToNumber
|
||||
_JS_ValueToBoolean
|
||||
_JS_TypeOfValue
|
||||
_JS_GetTypeName
|
||||
_JS_Lock
|
||||
_JS_Unlock
|
||||
_JS_NewContext
|
||||
_JS_DestroyContext
|
||||
_JS_ContextIterator
|
||||
_JS_GetGlobalObject
|
||||
_JS_SetGlobalObject
|
||||
_JS_InitStandardClasses
|
||||
; _JS_GetStaticLink
|
||||
_JS_malloc
|
||||
_JS_realloc
|
||||
_JS_free
|
||||
_JS_strdup
|
||||
_JS_NewDouble
|
||||
_JS_NewDoubleValue
|
||||
_JS_AddRoot
|
||||
_JS_RemoveRoot
|
||||
_JS_LockGCThing
|
||||
_JS_UnlockGCThing
|
||||
_JS_GC
|
||||
_JS_PropertyStub
|
||||
_JS_EnumerateStub
|
||||
_JS_ResolveStub
|
||||
_JS_ConvertStub
|
||||
_JS_FinalizeStub
|
||||
_JS_InitClass
|
||||
_JS_GetClass
|
||||
_JS_InstanceOf
|
||||
_JS_GetPrivate
|
||||
_JS_SetPrivate
|
||||
_JS_GetInstancePrivate
|
||||
_JS_GetPrototype
|
||||
_JS_GetParent
|
||||
_JS_SetParent
|
||||
_JS_GetConstructor
|
||||
_JS_NewObject
|
||||
_JS_DefineObject
|
||||
_JS_DefineConstDoubles
|
||||
_JS_DefineProperties
|
||||
_JS_DefineProperty
|
||||
_JS_DefinePropertyWithTinyId
|
||||
_JS_AliasProperty
|
||||
_JS_LookupProperty
|
||||
_JS_GetProperty
|
||||
_JS_SetProperty
|
||||
_JS_DeleteProperty
|
||||
_JS_NewArrayObject
|
||||
_JS_DefineElement
|
||||
_JS_AliasElement
|
||||
_JS_LookupElement
|
||||
_JS_GetElement
|
||||
_JS_SetElement
|
||||
_JS_DeleteElement
|
||||
_JS_ClearScope
|
||||
_JS_NewFunction
|
||||
_JS_GetFunctionObject
|
||||
_JS_GetFunctionName
|
||||
_JS_DefineFunctions
|
||||
_JS_DefineFunction
|
||||
_JS_CompileScript
|
||||
_JS_DestroyScript
|
||||
_JS_CompileFunction
|
||||
_JS_DecompileScript
|
||||
_JS_DecompileFunction
|
||||
_JS_DecompileFunctionBody
|
||||
_JS_ExecuteScript
|
||||
_JS_EvaluateScript
|
||||
_JS_CallFunction
|
||||
_JS_CallFunctionName
|
||||
_JS_CallFunctionValue
|
||||
_JS_SetBranchCallback
|
||||
_JS_IsRunning
|
||||
_JS_NewString
|
||||
_JS_NewStringCopyN
|
||||
_JS_NewStringCopyZ
|
||||
_JS_InternString
|
||||
_JS_GetStringBytes
|
||||
_JS_GetStringLength
|
||||
_JS_CompareStrings
|
||||
_JS_ReportError
|
||||
_JS_ReportOutOfMemory
|
||||
_JS_SetErrorReporter
|
||||
_JS_NewRegExpObject
|
||||
_JS_SetRegExpInput
|
||||
_JS_ClearRegExpStatics
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
60
mozilla/js/src/js1640.rc
Normal file
60
mozilla/js/src/js1640.rc
Normal file
@@ -0,0 +1,60 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Version stamp for this .DLL
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <ver.h>
|
||||
|
||||
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
|
||||
FILEVERSION 4 // major, minor, release (alpha 1), build #
|
||||
|
||||
PRODUCTVERSION 4
|
||||
|
||||
FILEFLAGSMASK 0
|
||||
|
||||
FILEFLAGS 0 // final version
|
||||
|
||||
FILEOS VOS_DOS_WINDOWS16
|
||||
|
||||
FILETYPE VFT_DLL
|
||||
|
||||
FILESUBTYPE 0 // not used
|
||||
|
||||
BEGIN
|
||||
|
||||
BLOCK "StringFileInfo"
|
||||
|
||||
BEGIN
|
||||
|
||||
BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
|
||||
|
||||
BEGIN
|
||||
|
||||
VALUE "CompanyName", "Netscape Communications Corporation\0"
|
||||
|
||||
VALUE "FileDescription", "Netscape 16-bit JavaScript Module\0"
|
||||
|
||||
VALUE "FileVersion", "4.0\0"
|
||||
|
||||
VALUE "InternalName", "JS1640\0"
|
||||
|
||||
VALUE "LegalCopyright", "Copyright Netscape Communications. 1994-96\0"
|
||||
|
||||
VALUE "LegalTrademarks", "Netscape, Mozilla\0"
|
||||
|
||||
VALUE "OriginalFilename","JS1640.DLL\0"
|
||||
|
||||
VALUE "ProductName", "NETSCAPE\0"
|
||||
|
||||
VALUE "ProductVersion", "4.0\0"
|
||||
|
||||
END
|
||||
|
||||
END
|
||||
|
||||
END
|
||||
|
||||
318
mozilla/js/src/js32.dsp
Normal file
318
mozilla/js/src/js32.dsp
Normal file
@@ -0,0 +1,318 @@
|
||||
# Microsoft Developer Studio Project File - Name="js32" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=js32 - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "js32.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "js32.mak" CFG="js32 - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "js32 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "js32 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "js32 - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir ".\js32\Release"
|
||||
# PROP BASE Intermediate_Dir ".\js32\Release"
|
||||
# PROP BASE Target_Dir ".\js32"
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ".\Release"
|
||||
# PROP Intermediate_Dir ".\Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ".\js32"
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "mininspr" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "JSFILE" /D "EXPORT_JS_API" /D "MINI_NSPR" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
# ADD LINK32 H:\ns\dist\WINNT4.0_OPT.OBJ\lib\libnspr21_s.lib H:\ns\dist\WINNT4.0_OPT.OBJ\lib\libplds21_s.lib winmm.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "js32 - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir ".\js32\Debug"
|
||||
# PROP BASE Intermediate_Dir ".\js32\Debug"
|
||||
# PROP BASE Target_Dir ".\js32"
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ".\Debug"
|
||||
# PROP Intermediate_Dir ".\Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ".\js32"
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "mininspr" /D "_DEBUG" /D "DEBUG" /D "_WINDOWS" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "JSFILE" /D "EXPORT_JS_API" /D "MINI_NSPR" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
|
||||
# ADD LINK32 H:\ns\dist\WINNT4.0_DBG.OBJ\lib\libnspr21_s.lib H:\ns\dist\WINNT4.0_DBG.OBJ\lib\libplds21_s.lib winmm.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "js32 - Win32 Release"
|
||||
# Name "js32 - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsapi.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsarray.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsatom.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsbool.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jscntxt.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsdate.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsdbgapi.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsemit.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsfun.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsgc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsinterp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jslock.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsmath.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsnum.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsobj.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsopcode.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsparse.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsregexp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscan.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscope.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscript.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsstr.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsxdrapi.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prarena.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prmjtime.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsapi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsarray.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsatom.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsbool.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jscntxt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsconfig.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsdate.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsdbgapi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsemit.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsfun.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsgc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsinterp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jslock.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsmath.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsnum.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsobj.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsopcode.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsparse.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsprvtd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jspubtd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsregexp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscan.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscope.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscript.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsstddef.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsstr.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsxdrapi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prarena.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prdtoa.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
79
mozilla/js/src/js3240.rc
Normal file
79
mozilla/js/src/js3240.rc
Normal file
@@ -0,0 +1,79 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winver.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 4,0,0,0
|
||||
PRODUCTVERSION 4,0,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x10004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904e4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Netscape Communications Corporation\0"
|
||||
VALUE "FileDescription", "Netscape 32-bit JavaScript Module\0"
|
||||
VALUE "FileVersion", "4.0\0"
|
||||
VALUE "InternalName", "JS3240\0"
|
||||
VALUE "LegalCopyright", "Copyright Netscape Communications. 1994-96\0"
|
||||
VALUE "LegalTrademarks", "Netscape, Mozilla\0"
|
||||
VALUE "OriginalFilename", "js3240.dll\0"
|
||||
VALUE "ProductName", "NETSCAPE\0"
|
||||
VALUE "ProductVersion", "4.0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""winver.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
623
mozilla/js/src/jsOS240.def
Normal file
623
mozilla/js/src/jsOS240.def
Normal file
@@ -0,0 +1,623 @@
|
||||
; The contents of this file are subject to the Netscape Public License
|
||||
; Version 1.0 (the "NPL"); you may not use this file except in
|
||||
; compliance with the NPL. You may obtain a copy of the NPL at
|
||||
; http://www.mozilla.org/NPL/
|
||||
;
|
||||
; Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
; for the specific language governing rights and limitations under the
|
||||
; NPL.
|
||||
;
|
||||
; The Initial Developer of this code under the NPL is Netscape
|
||||
; Communications Corporation. Portions created by Netscape are
|
||||
; Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
; Reserved.
|
||||
|
||||
LIBRARY JS3240 INITINSTANCE TERMINSTANCE
|
||||
PROTMODE
|
||||
|
||||
DESCRIPTION 'Netscape OS/2 JavaScript Library'
|
||||
|
||||
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE NONSHARED
|
||||
|
||||
|
||||
EXPORTS
|
||||
;====================== win16 exports these at least... ===========
|
||||
; JS_Init = JS_Init @2
|
||||
; JS_Finish = JS_Finish @3
|
||||
; JS_GetNaNValue
|
||||
; JS_GetNegativeInfinityValue
|
||||
; JS_GetPositiveInfinityValue
|
||||
; JS_GetEmptyStringValue
|
||||
; JS_ConvertValue
|
||||
; JS_ValueToObject
|
||||
; JS_ValueToFunction
|
||||
; JS_ValueToString
|
||||
; JS_ValueToNumber
|
||||
; JS_ValueToBoolean
|
||||
; JS_TypeOfValue
|
||||
; JS_GetTypeName
|
||||
; JS_Lock
|
||||
; JS_Unlock
|
||||
; JS_NewContext
|
||||
; JS_DestroyContext
|
||||
; JS_ContextIterator
|
||||
; JS_GetGlobalObject
|
||||
; JS_SetGlobalObject
|
||||
; JS_InitStandardClasses
|
||||
;; JS_GetStaticLink
|
||||
; JS_malloc
|
||||
; JS_realloc
|
||||
; JS_free
|
||||
; JS_strdup
|
||||
; JS_NewDouble
|
||||
; JS_NewDoubleValue
|
||||
; JS_AddRoot
|
||||
; JS_RemoveRoot
|
||||
; JS_LockGCThing
|
||||
; JS_UnlockGCThing
|
||||
; JS_GC
|
||||
; JS_PropertyStub
|
||||
; JS_EnumerateStub
|
||||
; JS_ResolveStub
|
||||
; JS_ConvertStub
|
||||
; JS_FinalizeStub
|
||||
; JS_InitClass
|
||||
; JS_GetClass
|
||||
; JS_InstanceOf
|
||||
; JS_GetPrivate
|
||||
; JS_SetPrivate
|
||||
; JS_GetInstancePrivate
|
||||
; JS_GetPrototype
|
||||
; JS_GetParent
|
||||
; JS_SetParent
|
||||
; JS_GetConstructor
|
||||
; JS_NewObject
|
||||
; JS_DefineObject
|
||||
; JS_DefineConstDoubles
|
||||
; JS_DefineProperties
|
||||
; JS_DefineProperty
|
||||
; JS_DefinePropertyWithTinyId
|
||||
; JS_AliasProperty
|
||||
; JS_LookupProperty
|
||||
; JS_GetProperty
|
||||
; JS_SetProperty
|
||||
; JS_DeleteProperty
|
||||
; JS_NewArrayObject
|
||||
; JS_DefineElement
|
||||
; JS_AliasElement
|
||||
; JS_LookupElement
|
||||
; JS_GetElement
|
||||
; JS_SetElement
|
||||
; JS_DeleteElement
|
||||
; JS_ClearScope
|
||||
; JS_NewFunction
|
||||
; JS_GetFunctionObject
|
||||
; JS_GetFunctionName
|
||||
; JS_DefineFunctions
|
||||
; JS_DefineFunction
|
||||
; JS_CompileScript
|
||||
; JS_DestroyScript
|
||||
; JS_CompileFunction
|
||||
; JS_DecompileScript
|
||||
; JS_DecompileFunction
|
||||
; JS_DecompileFunctionBody
|
||||
; JS_ExecuteScript
|
||||
; JS_EvaluateScript
|
||||
; JS_CallFunction
|
||||
; JS_CallFunctionName
|
||||
; JS_CallFunctionValue
|
||||
; JS_SetBranchCallback
|
||||
; JS_IsRunning
|
||||
; JS_NewString
|
||||
; JS_NewStringCopyN
|
||||
; JS_NewStringCopyZ
|
||||
; JS_InternString
|
||||
; JS_GetStringBytes
|
||||
; JS_GetStringLength
|
||||
; JS_CompareStrings
|
||||
; JS_ReportError
|
||||
; JS_ReportOutOfMemory
|
||||
; JS_SetErrorReporter
|
||||
; JS_NewRegExpObject
|
||||
; JS_SetRegExpInput
|
||||
; JS_ClearRegExpStatics
|
||||
;=================================================
|
||||
|
||||
|
||||
;00001:jsstr (OFFSET:0x00002e17, SIZE:0x0000ae17):
|
||||
; - Public Definitions:
|
||||
; js_EmptySubString
|
||||
; js_CompareStrings
|
||||
; js_HashString
|
||||
; js_ValueToString
|
||||
; js_StringToObject
|
||||
; js_FinalizeString
|
||||
; js_NewStringCopyZ
|
||||
; js_NewString
|
||||
; js_InitStringClass
|
||||
; js_NewStringCopyN
|
||||
; js_BoyerMooreHorspool
|
||||
;
|
||||
;
|
||||
;00002:jsscript (OFFSET:0x0000dc2e, SIZE:0x00003abb):
|
||||
; - Public Definitions:
|
||||
; js_LineNumberToPC
|
||||
; js_PCToLineNumber
|
||||
; js_GetSrcNote
|
||||
; js_DestroyScript
|
||||
; js_NewScript
|
||||
;
|
||||
;
|
||||
;00003:jsscope (OFFSET:0x000116e9, SIZE:0x00004f82):
|
||||
; - Public Definitions:
|
||||
; js_hash_scope_ops
|
||||
; js_list_scope_ops
|
||||
; js_DestroyProperty
|
||||
; js_NewProperty
|
||||
; js_IdToValue
|
||||
; js_HashValue
|
||||
; js_DestroyScope
|
||||
; js_MutateScope
|
||||
; js_DropScope
|
||||
; js_HoldScope
|
||||
; js_NewScope
|
||||
; js_GetMutableScope
|
||||
; js_HoldProperty
|
||||
; js_DropProperty
|
||||
;
|
||||
;
|
||||
;00004:jsscan (OFFSET:0x0001666b, SIZE:0x00008890):
|
||||
; - Public Definitions:
|
||||
; js_MatchToken
|
||||
; js_FlushNewlines
|
||||
; js_PeekTokenSameLine
|
||||
; js_UngetToken
|
||||
; js_GetToken
|
||||
; js_PeekToken
|
||||
; js_ReportCompileError
|
||||
js_CloseTokenStream
|
||||
js_NewBufferTokenStream
|
||||
; js_NewTokenStream
|
||||
; js_InitScanner
|
||||
;
|
||||
;
|
||||
;00005:jsregexp (OFFSET:0x0001eefb, SIZE:0x0000eee4):
|
||||
; - Public Definitions:
|
||||
; js_RegExpClass
|
||||
; reopsize
|
||||
; js_NewRegExpObject
|
||||
; js_InitRegExpClass
|
||||
; js_FreeRegExpStatics
|
||||
; js_InitRegExpStatics
|
||||
; js_ExecuteRegExp
|
||||
; js_NewRegExpOpt
|
||||
; js_DestroyRegExp
|
||||
; js_NewRegExp
|
||||
;
|
||||
;
|
||||
;00006:jsparse (OFFSET:0x0002dddf, SIZE:0x00010b71):
|
||||
; - Public Definitions:
|
||||
; js_ParseFunctionBody
|
||||
js_Parse
|
||||
;
|
||||
;
|
||||
;00007:jsopcode (OFFSET:0x0003e950, SIZE:0x0000d362):
|
||||
; - Public Definitions:
|
||||
; js_EscapeMap
|
||||
; js_NumCodeSpecs
|
||||
; js_CodeSpec
|
||||
; js_incop_str
|
||||
; js_true_str
|
||||
; js_false_str
|
||||
; js_this_str
|
||||
; js_null_str
|
||||
; js_void_str
|
||||
; js_typeof_str
|
||||
; js_delete_str
|
||||
; js_new_str
|
||||
; js_ValueToSource
|
||||
; js_DecompileScript
|
||||
; js_DecompileCode
|
||||
; js_DecompileFunction
|
||||
; js_puts
|
||||
; js_printf
|
||||
; js_GetPrinterOutput
|
||||
; js_DestroyPrinter
|
||||
; js_NewPrinter
|
||||
; js_EscapeString
|
||||
; js_Disassemble1
|
||||
; js_Disassemble
|
||||
;
|
||||
;00008:jsobj (OFFSET:0x0004bcb2, SIZE:0x000090a4):
|
||||
; - Public Definitions:
|
||||
; js_WithClass
|
||||
; js_ObjectClass
|
||||
; js_TryValueOf
|
||||
; js_ValueToNonNullObject
|
||||
; js_TryMethod
|
||||
; js_ObjectToString
|
||||
; js_SetClassPrototype
|
||||
; js_DeleteProperty2
|
||||
; js_DeleteProperty
|
||||
; js_SetProperty
|
||||
; js_GetProperty
|
||||
; js_FindVariableScope
|
||||
; js_FindVariable
|
||||
; js_FindProperty
|
||||
; js_LookupProperty
|
||||
; js_DefineProperty
|
||||
; js_FreeSlot
|
||||
; js_AllocSlot
|
||||
; js_FinalizeObject
|
||||
; js_GetClassPrototype
|
||||
; js_NewObject
|
||||
; js_InitObjectClass
|
||||
; js_ValueToObject
|
||||
; js_obj_toString
|
||||
; js_SetSlot
|
||||
; js_GetSlot
|
||||
;
|
||||
;
|
||||
;00009:jsnum (OFFSET:0x00054d56, SIZE:0x00004f29):
|
||||
; - Public Definitions:
|
||||
; js_ValueToInt32
|
||||
; js_NumberToObject
|
||||
; js_FinalizeDouble
|
||||
; js_InitNumberClass
|
||||
; js_NumberToString
|
||||
; js_NewDoubleValue
|
||||
; js_NewDouble
|
||||
; js_ValueToNumber
|
||||
;
|
||||
;
|
||||
;00010:jsmath (OFFSET:0x00059c7f, SIZE:0x000054b6):
|
||||
; - Public Definitions:
|
||||
; js_InitMathClass
|
||||
;
|
||||
;
|
||||
;00011:jsjava (OFFSET:0x0005f135, SIZE:0x00022aad):
|
||||
; - Public Definitions:
|
||||
; js_Hooks
|
||||
; MojaSrcLog
|
||||
; finalizeTask
|
||||
JSJ_FindCurrentJSContext
|
||||
; JSJ_GetPrincipals
|
||||
JSJ_IsSafeMethod
|
||||
JSJ_InitContext
|
||||
JSJ_Init
|
||||
js_JSErrorToJException
|
||||
js_JavaErrorReporter
|
||||
js_RemoveReflection
|
||||
js_ReflectJObjectToJSObject
|
||||
js_convertJObjectToJSValue
|
||||
js_convertJSValueToJObject
|
||||
js_ReflectJSObjectToJObject
|
||||
; js_ReflectJClassToJSObject
|
||||
JSJ_ExitJS
|
||||
JSJ_EnterJS
|
||||
JSJ_CurrentContext
|
||||
JSJ_IsEnabled
|
||||
;added in GA code - DSR70297
|
||||
JSJ_Finish
|
||||
JSJ_IsCalledFromJava
|
||||
js_GetJSPrincipalsFromJavaCaller
|
||||
|
||||
;
|
||||
;
|
||||
;00012:jsinterp (OFFSET:0x00081be2, SIZE:0x00012274):
|
||||
; - Public Definitions:
|
||||
; js_Call
|
||||
; js_Interpret
|
||||
; js_SetLocalVariable
|
||||
; js_GetLocalVariable
|
||||
; js_SetArgument
|
||||
; js_GetArgument
|
||||
; js_FlushPropertyCacheByProp
|
||||
; js_FlushPropertyCache
|
||||
;
|
||||
;
|
||||
;00013:jsgc (OFFSET:0x00093e56, SIZE:0x00004f8d):
|
||||
; - Public Definitions:
|
||||
; js_ForceGC
|
||||
; js_UnlockGCThing
|
||||
; js_LockGCThing
|
||||
; js_GC
|
||||
; js_AllocGCThing
|
||||
; js_RemoveRoot
|
||||
; js_AddRoot
|
||||
; js_FinishGC
|
||||
; js_InitGC
|
||||
;
|
||||
;
|
||||
;00014:jsfun (OFFSET:0x00098de3, SIZE:0x0000977c):
|
||||
; - Public Definitions:
|
||||
; js_FunctionClass
|
||||
; js_ClosureClass
|
||||
; js_CallClass
|
||||
; js_DefineFunction
|
||||
; js_NewFunction
|
||||
; js_InitCallAndClosureClasses
|
||||
; js_InitFunctionClass
|
||||
; js_ValueToFunction
|
||||
; js_SetCallVariable
|
||||
; js_GetCallVariable
|
||||
; js_PutCallObject
|
||||
; js_GetCallObject
|
||||
;
|
||||
;
|
||||
;00015:jsemit (OFFSET:0x000a255f, SIZE:0x000077be):
|
||||
; - Public Definitions:
|
||||
; js_SrcNoteName
|
||||
; js_SrcNoteArity
|
||||
js_FinishTakingSrcNotes
|
||||
; js_MoveSrcNotes
|
||||
; js_GetSrcNoteOffset
|
||||
; js_BumpSrcNoteDelta
|
||||
; js_NewSrcNote3
|
||||
; js_NewSrcNote2
|
||||
; js_PopStatement
|
||||
; js_EmitContinue
|
||||
; js_EmitBreak
|
||||
; js_SetSrcNoteOffset
|
||||
; js_NewSrcNote
|
||||
; js_PushStatement
|
||||
; js_MoveCode
|
||||
; js_SetJumpOffset
|
||||
; js_Emit3
|
||||
; js_Emit2
|
||||
; js_Emit1
|
||||
; js_UpdateDepth
|
||||
; js_SrcNoteLength
|
||||
; js_CancelLastOpcode
|
||||
js_InitCodeGenerator
|
||||
;
|
||||
;
|
||||
;00016:jsdbgapi (OFFSET:0x000a9d1d, SIZE:0x000057db):
|
||||
; - Public Definitions:
|
||||
; js_watchpoint_list
|
||||
; js_trap_list
|
||||
; JS_SetAnnotationInFrame
|
||||
; JS_GetAnnotationFromFrame
|
||||
; JS_GetJSPrincipalArrayFromFrame
|
||||
; JS_NextJSFrame
|
||||
; JS_InitJSFrameIterator
|
||||
JS_LineNumberToPC
|
||||
JS_PCToLineNumber
|
||||
JS_ClearAllWatchPoints
|
||||
JS_ClearWatchPoint
|
||||
JS_SetWatchPoint
|
||||
JS_HandleTrap
|
||||
JS_ClearAllTraps
|
||||
JS_ClearScriptTraps
|
||||
JS_ClearTrap
|
||||
JS_GetTrapOpcode
|
||||
JS_SetTrap
|
||||
;DSR070297 - added in GA code
|
||||
JS_FrameIterator
|
||||
JS_GetFrameAnnotation
|
||||
JS_GetFramePrincipalArray
|
||||
JS_GetFrameScript
|
||||
JS_GetScriptFilename
|
||||
JS_SetFrameAnnotation
|
||||
JS_GetFramePC
|
||||
JS_GetFunctionScript
|
||||
|
||||
;
|
||||
;
|
||||
;00017:jsdate (OFFSET:0x000af4f8, SIZE:0x00009a8e):
|
||||
; - Public Definitions:
|
||||
js_DateGetSeconds
|
||||
js_DateGetMinutes
|
||||
js_DateGetHours
|
||||
js_DateGetDate
|
||||
js_DateGetMonth
|
||||
js_DateGetYear
|
||||
js_NewDateObject
|
||||
; js_InitDateClass
|
||||
;
|
||||
;
|
||||
;00018:jscntxt (OFFSET:0x000b8f86, SIZE:0x00003732):
|
||||
; - Public Definitions:
|
||||
; js_InterpreterHooks
|
||||
; js_ReportIsNotDefined
|
||||
; js_ReportErrorAgain
|
||||
; js_ReportErrorVA
|
||||
; js_ContextIterator
|
||||
; js_DestroyContext
|
||||
; js_NewContext
|
||||
; js_SetInterpreterHooks
|
||||
;
|
||||
;
|
||||
;00019:jsbool (OFFSET:0x000bc6b8, SIZE:0x00003375):
|
||||
; - Public Definitions:
|
||||
; js_BooleanToString
|
||||
; js_BooleanToObject
|
||||
; js_InitBooleanClass
|
||||
; js_ValueToBoolean
|
||||
;
|
||||
;
|
||||
;00020:jsatom (OFFSET:0x000bfa2d, SIZE:0x000058d0):
|
||||
; - Public Definitions:
|
||||
; js_valueOf_str
|
||||
; js_toString_str
|
||||
; js_length_str
|
||||
; js_eval_str
|
||||
; js_constructor_str
|
||||
; js_class_prototype_str
|
||||
; js_assign_str
|
||||
; js_anonymous_str
|
||||
; js_Object_str
|
||||
; js_Array_str
|
||||
; js_type_str
|
||||
; js_DropUnmappedAtoms
|
||||
js_FreeAtomMap
|
||||
js_InitAtomMap
|
||||
; js_GetAtom
|
||||
; js_DropAtom
|
||||
; js_IndexAtom
|
||||
; js_ValueToStringAtom
|
||||
; js_AtomizeString
|
||||
; js_AtomizeDouble
|
||||
; js_AtomizeInt
|
||||
; js_AtomizeBoolean
|
||||
; js_AtomizeObject
|
||||
; js_HoldAtom
|
||||
; js_MarkAtomState
|
||||
; js_FreeAtomState
|
||||
; js_Atomize
|
||||
; js_InitAtomState
|
||||
;
|
||||
;
|
||||
;00021:jsarray (OFFSET:0x000c52fd, SIZE:0x00007c86):
|
||||
; - Public Definitions:
|
||||
; js_ArrayClass
|
||||
; js_SetArrayLength
|
||||
; js_GetArrayLength
|
||||
; js_InitArrayClass
|
||||
; js_NewArrayObject
|
||||
; PR_qsort
|
||||
;
|
||||
;
|
||||
;00022:jsapi (OFFSET:0x000ccf83, SIZE:0x0000de8c):
|
||||
; - Public Definitions:
|
||||
JS_ClearRegExpStatics
|
||||
JS_SetRegExpInput
|
||||
JS_NewRegExpObject
|
||||
JS_SetErrorReporter
|
||||
JS_CompareStrings
|
||||
JS_GetStringLength
|
||||
JS_GetStringBytes
|
||||
JS_InternString
|
||||
JS_NewStringCopyZ
|
||||
JS_NewStringCopyN
|
||||
JS_NewString
|
||||
JS_IsRunning
|
||||
JS_SetBranchCallback
|
||||
JS_CallFunctionValue
|
||||
JS_CallFunctionName
|
||||
JS_CallFunction
|
||||
JS_EvaluateScriptForPrincipals
|
||||
JS_EvaluateScript
|
||||
JS_ExecuteScript
|
||||
JS_DecompileFunctionBody
|
||||
JS_DecompileFunction
|
||||
JS_DecompileScript
|
||||
JS_CompileFunctionForPrincipals
|
||||
JS_CompileFunction
|
||||
JS_DestroyScript
|
||||
JS_CompileScriptForPrincipals
|
||||
JS_CompileScript
|
||||
JS_DefineFunction
|
||||
JS_GetFunctionName
|
||||
JS_GetFunctionObject
|
||||
JS_NewFunction
|
||||
JS_ClearScope
|
||||
JS_DeleteElement
|
||||
JS_SetElement
|
||||
JS_GetElement
|
||||
JS_LookupElement
|
||||
JS_AliasElement
|
||||
JS_DefineElement
|
||||
JS_SetArrayLength
|
||||
JS_GetArrayLength
|
||||
JS_NewArrayObject
|
||||
JS_DeleteProperty
|
||||
JS_SetProperty
|
||||
JS_GetProperty
|
||||
JS_LookupProperty
|
||||
JS_AliasProperty
|
||||
JS_DefinePropertyWithTinyId
|
||||
JS_DefineProperty
|
||||
JS_DefineConstDoubles
|
||||
JS_DefineObject
|
||||
JS_NewObject
|
||||
JS_GetConstructor
|
||||
JS_SetParent
|
||||
JS_GetParent
|
||||
JS_SetPrototype
|
||||
JS_GetPrototype
|
||||
JS_GetInstancePrivate
|
||||
JS_SetPrivate
|
||||
JS_GetPrivate
|
||||
JS_InstanceOf
|
||||
JS_GetClass
|
||||
JS_DefineFunctions
|
||||
JS_DefineProperties
|
||||
JS_InitClass
|
||||
JS_FinalizeStub
|
||||
JS_ConvertStub
|
||||
JS_ResolveStub
|
||||
JS_EnumerateStub
|
||||
JS_PropertyStub
|
||||
JS_GC
|
||||
JS_UnlockGCThing
|
||||
JS_LockGCThing
|
||||
JS_RemoveRoot
|
||||
JS_AddRoot
|
||||
JS_NewDoubleValue
|
||||
JS_NewDouble
|
||||
JS_strdup
|
||||
JS_free
|
||||
JS_realloc
|
||||
JS_ReportOutOfMemory
|
||||
JS_malloc
|
||||
JS_GetScopeChain
|
||||
JS_InitStandardClasses
|
||||
JS_SetGlobalObject
|
||||
JS_GetGlobalObject
|
||||
JS_SetVersion
|
||||
JS_GetVersion
|
||||
JS_ContextIterator
|
||||
JS_GetTaskState
|
||||
JS_DestroyContext
|
||||
JS_NewContext
|
||||
JS_Unlock
|
||||
JS_Lock
|
||||
JS_Finish
|
||||
JS_Init
|
||||
JS_GetTypeName
|
||||
JS_TypeOfValue
|
||||
JS_ValueToBoolean
|
||||
JS_ValueToInt32
|
||||
JS_ValueToNumber
|
||||
JS_ValueToString
|
||||
JS_ValueToFunction
|
||||
JS_ValueToObject
|
||||
JS_ReportError
|
||||
JS_ConvertValue
|
||||
JS_GetEmptyStringValue
|
||||
JS_GetPositiveInfinityValue
|
||||
JS_GetNegativeInfinityValue
|
||||
JS_GetNaNValue
|
||||
;DSR062897 - added for GA code
|
||||
JS_MaybeGC
|
||||
JS_GetScriptPrincipals
|
||||
JS_IsAssigning
|
||||
JS_SetCharSetInfo
|
||||
;
|
||||
;
|
||||
;00023:prmjtime (OFFSET:0x000dae0f, SIZE:0x00008986):
|
||||
; - Public Definitions:
|
||||
PRMJ_FormatTimeUSEnglish
|
||||
PRMJ_gmtime
|
||||
PRMJ_FormatTime
|
||||
PRMJ_mktime
|
||||
PRMJ_ComputeTime
|
||||
PRMJ_localtime
|
||||
PRMJ_ExplodeTime
|
||||
PRMJ_ToLocal
|
||||
PRMJ_ToGMT
|
||||
PRMJ_NowLocal
|
||||
PRMJ_DSTOffset
|
||||
PRMJ_NowS
|
||||
PRMJ_NowMS
|
||||
PRMJ_Now
|
||||
PRMJ_ToExtendedTime
|
||||
PRMJ_ToBaseTime
|
||||
PRMJ_setDST
|
||||
PRMJ_LocalGMTDifference
|
||||
|
||||
|
||||
42
mozilla/js/src/jsaddr.c
Normal file
42
mozilla/js/src/jsaddr.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/* -*- Mode: C; tab-width: 8 -*-
|
||||
* Copyright © 1996 Netscape Communications Corporation, All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsinterp.h"
|
||||
|
||||
/* These functions are needed to get the addresses of certain functions
|
||||
* in the JS module. On WIN32 especially, these symbols have a different
|
||||
* address from the actual address of these functions in the JS module.
|
||||
* This is because on WIN32, import function address fixups are done only
|
||||
* at load time and function calls are made by indirection - that is by
|
||||
* using a couple extra instructions to lookup the actual function address
|
||||
* in the importing module's import address table.
|
||||
*/
|
||||
|
||||
IMPLEMENT(JSPropertyOp)
|
||||
js_GetArgumentAddress()
|
||||
{
|
||||
return ((void *)js_GetArgument);
|
||||
}
|
||||
|
||||
IMPLEMENT(JSPropertyOp)
|
||||
js_SetArgumentAddress()
|
||||
{
|
||||
return ((void *)js_SetArgument);
|
||||
}
|
||||
|
||||
IMPLEMENT(JSPropertyOp)
|
||||
js_GetLocalVariableAddress()
|
||||
{
|
||||
return ((void *)js_GetLocalVariable);
|
||||
}
|
||||
|
||||
IMPLEMENT(JSPropertyOp)
|
||||
js_SetLocalVariableAddress()
|
||||
{
|
||||
return ((void *)js_SetLocalVariable);
|
||||
}
|
||||
20
mozilla/js/src/jsaddr.h
Normal file
20
mozilla/js/src/jsaddr.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/* -*- Mode: C; tab-width: 8 -*-
|
||||
* Copyright © 1996 Netscape Communications Corporation, All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef jsaddr_h___
|
||||
#define jsaddr_h___
|
||||
|
||||
EXTERN(JSPropertyOp)
|
||||
js_GetArgumentAddress();
|
||||
|
||||
EXTERN(JSPropertyOp)
|
||||
js_SetArgumentAddress();
|
||||
|
||||
EXTERN(JSPropertyOp)
|
||||
js_GetLocalVariableAddress();
|
||||
|
||||
EXTERN(JSPropertyOp)
|
||||
js_SetLocalVariableAddress();
|
||||
|
||||
#endif /* jsaddr_h___ */
|
||||
2756
mozilla/js/src/jsapi.c
Normal file
2756
mozilla/js/src/jsapi.c
Normal file
File diff suppressed because it is too large
Load Diff
1058
mozilla/js/src/jsapi.h
Normal file
1058
mozilla/js/src/jsapi.h
Normal file
File diff suppressed because it is too large
Load Diff
343
mozilla/js/src/jsarena.c
Normal file
343
mozilla/js/src/jsarena.c
Normal file
@@ -0,0 +1,343 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Lifetime-based fast allocation, inspired by much prior art, including
|
||||
* "Fast Allocation and Deallocation of Memory Based on Object Lifetimes"
|
||||
* David R. Hanson, Software -- Practice and Experience, Vol. 20(1).
|
||||
*/
|
||||
#include "jsstddef.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#include "jsbit.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
extern js_CompareAndSwap(jsword *, jsword, jsword);
|
||||
#endif
|
||||
|
||||
static JSArena *arena_freelist;
|
||||
|
||||
#ifdef JS_ARENAMETER
|
||||
static JSArenaStats *arena_stats_list;
|
||||
|
||||
#define COUNT(pool,what) (pool)->stats.what++
|
||||
#else
|
||||
#define COUNT(pool,what) /* nothing */
|
||||
#endif
|
||||
|
||||
#define JS_ARENA_DEFAULT_ALIGN sizeof(double)
|
||||
|
||||
IMPLEMENT(void)
|
||||
JS_InitArenaPool(JSArenaPool *pool, const char *name, JSUint32 size, JSUint32 align)
|
||||
{
|
||||
if (align == 0)
|
||||
align = JS_ARENA_DEFAULT_ALIGN;
|
||||
pool->mask = JS_BITMASK(JS_CeilingLog2(align));
|
||||
pool->first.next = NULL;
|
||||
pool->first.base = pool->first.avail = pool->first.limit =
|
||||
(jsuword)JS_ARENA_ALIGN(pool, &pool->first + 1);
|
||||
pool->current = &pool->first;
|
||||
pool->arenasize = size;
|
||||
#ifdef JS_ARENAMETER
|
||||
memset(&pool->stats, 0, sizeof pool->stats);
|
||||
pool->stats.name = strdup(name);
|
||||
pool->stats.next = arena_stats_list;
|
||||
arena_stats_list = &pool->stats;
|
||||
#endif
|
||||
}
|
||||
|
||||
IMPLEMENT(void *)
|
||||
JS_ArenaAllocate(JSArenaPool *pool, JSUint32 nb)
|
||||
{
|
||||
JSArena **ap, *a, *b;
|
||||
#ifdef JS_THREADSAFE
|
||||
JSArena *c;
|
||||
#endif
|
||||
JSUint32 sz;
|
||||
void *p;
|
||||
|
||||
JS_ASSERT((nb & pool->mask) == 0);
|
||||
#if defined(XP_PC) && !defined(_WIN32)
|
||||
if (nb >= 60000U)
|
||||
return 0;
|
||||
#endif /* WIN16 */
|
||||
ap = &arena_freelist;
|
||||
for (a = pool->current; a->avail + nb > a->limit; pool->current = a) {
|
||||
if (a->next) { /* move to next arena */
|
||||
a = a->next;
|
||||
continue;
|
||||
}
|
||||
while ((b = *ap) != NULL) { /* reclaim a free arena */
|
||||
if (b->limit - b->base == pool->arenasize) {
|
||||
#ifdef JS_THREADSAFE
|
||||
do {
|
||||
b = *ap;
|
||||
c = b->next;
|
||||
} while (!js_CompareAndSwap((jsword *)ap,(jsword)b,(jsword)c));
|
||||
#else
|
||||
*ap = b->next;
|
||||
#endif
|
||||
b->next = NULL;
|
||||
a = a->next = b;
|
||||
COUNT(pool, nreclaims);
|
||||
goto claim;
|
||||
}
|
||||
ap = &b->next;
|
||||
}
|
||||
sz = JS_MAX(pool->arenasize, nb); /* allocate a new arena */
|
||||
sz += sizeof *a + pool->mask; /* header and alignment slop */
|
||||
b = malloc(sz);
|
||||
if (!b)
|
||||
return 0;
|
||||
a = a->next = b;
|
||||
a->next = NULL;
|
||||
a->limit = (jsuword)a + sz;
|
||||
JS_COUNT_ARENA(pool,++);
|
||||
COUNT(pool, nmallocs);
|
||||
claim:
|
||||
a->base = a->avail = (jsuword)JS_ARENA_ALIGN(pool, a + 1);
|
||||
}
|
||||
p = (void *)a->avail;
|
||||
a->avail += nb;
|
||||
return p;
|
||||
}
|
||||
|
||||
IMPLEMENT(void *)
|
||||
JS_ArenaGrow(JSArenaPool *pool, void *p, JSUint32 size, JSUint32 incr)
|
||||
{
|
||||
void *newp;
|
||||
|
||||
JS_ARENA_ALLOCATE(newp, pool, size + incr);
|
||||
memcpy(newp, p, size);
|
||||
return newp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free tail arenas linked after head, which may not be the true list head.
|
||||
* Reset pool->current to point to head in case it pointed at a tail arena.
|
||||
*/
|
||||
static void
|
||||
FreeArenaList(JSArenaPool *pool, JSArena *head, JSBool reallyFree)
|
||||
{
|
||||
JSArena **ap, *a;
|
||||
#ifdef JS_THREADSAFE
|
||||
JSArena *b;
|
||||
#endif
|
||||
|
||||
ap = &head->next;
|
||||
a = *ap;
|
||||
if (!a)
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
JS_ASSERT(a->base <= a->avail && a->avail <= a->limit);
|
||||
a->avail = a->base;
|
||||
JS_CLEAR_UNUSED(a);
|
||||
} while ((a = a->next) != NULL);
|
||||
a = *ap;
|
||||
#endif
|
||||
|
||||
if (reallyFree) {
|
||||
do {
|
||||
*ap = a->next;
|
||||
JS_CLEAR_ARENA(a);
|
||||
JS_COUNT_ARENA(pool,--);
|
||||
free(a);
|
||||
} while ((a = *ap) != NULL);
|
||||
} else {
|
||||
/* Insert the whole arena chain at the front of the freelist. */
|
||||
do {
|
||||
ap = &(*ap)->next;
|
||||
} while (*ap);
|
||||
#ifdef JS_THREADSAFE
|
||||
do {
|
||||
*ap = b = arena_freelist;
|
||||
} while (!js_CompareAndSwap((jsword*)&arena_freelist,(jsword)b,(jsword)a));
|
||||
#else
|
||||
*ap = arena_freelist;
|
||||
arena_freelist = a;
|
||||
#endif
|
||||
head->next = NULL;
|
||||
}
|
||||
|
||||
pool->current = head;
|
||||
}
|
||||
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaRelease(JSArenaPool *pool, char *mark)
|
||||
{
|
||||
JSArena *a;
|
||||
|
||||
for (a = pool->first.next; a; a = a->next) {
|
||||
if (JS_UPTRDIFF(mark, a) < JS_UPTRDIFF(a->avail, a)) {
|
||||
a->avail = (jsuword)JS_ARENA_ALIGN(pool, mark);
|
||||
FreeArenaList(pool, a, JS_TRUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IMPLEMENT(void)
|
||||
JS_FreeArenaPool(JSArenaPool *pool)
|
||||
{
|
||||
FreeArenaList(pool, &pool->first, JS_FALSE);
|
||||
COUNT(pool, ndeallocs);
|
||||
}
|
||||
|
||||
IMPLEMENT(void)
|
||||
JS_FinishArenaPool(JSArenaPool *pool)
|
||||
{
|
||||
FreeArenaList(pool, &pool->first, JS_TRUE);
|
||||
#ifdef JS_ARENAMETER
|
||||
{
|
||||
JSArenaStats *stats, **statsp;
|
||||
|
||||
if (pool->stats.name)
|
||||
free(pool->stats.name);
|
||||
for (statsp = &arena_stats_list; (stats = *statsp) != 0;
|
||||
statsp = &stats->next) {
|
||||
if (stats == &pool->stats) {
|
||||
*statsp = stats->next;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
IMPLEMENT(void)
|
||||
JS_CompactArenaPool(JSArenaPool *pool)
|
||||
{
|
||||
#if 0 /* XP_MAC */
|
||||
JSArena *a = pool->first.next;
|
||||
|
||||
while (a) {
|
||||
reallocSmaller(a, a->avail - (jsuword)a);
|
||||
a->limit = a->avail;
|
||||
a = a->next;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaFinish()
|
||||
{
|
||||
JSArena *a, *next;
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
while (arena_freelist) {
|
||||
a = arena_freelist;
|
||||
next = a->next;
|
||||
if (js_CompareAndSwap((jsword*)&arena_freelist,(jsword)a,(jsword)next))
|
||||
free(a);
|
||||
}
|
||||
#else
|
||||
for (a = arena_freelist; a; a = next) {
|
||||
next = a->next;
|
||||
free(a);
|
||||
}
|
||||
arena_freelist = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef JS_ARENAMETER
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaCountAllocation(JSArenaPool *pool, JSUint32 nb)
|
||||
{
|
||||
pool->stats.nallocs++;
|
||||
pool->stats.nbytes += nb;
|
||||
if (nb > pool->stats.maxalloc)
|
||||
pool->stats.maxalloc = nb;
|
||||
pool->stats.variance += nb * nb;
|
||||
}
|
||||
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaCountInplaceGrowth(JSArenaPool *pool, JSUint32 size, JSUint32 incr)
|
||||
{
|
||||
pool->stats.ninplace++;
|
||||
}
|
||||
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaCountGrowth(JSArenaPool *pool, JSUint32 size, JSUint32 incr)
|
||||
{
|
||||
pool->stats.ngrows++;
|
||||
pool->stats.nbytes += incr;
|
||||
pool->stats.variance -= size * size;
|
||||
size += incr;
|
||||
if (size > pool->stats.maxalloc)
|
||||
pool->stats.maxalloc = size;
|
||||
pool->stats.variance += size * size;
|
||||
}
|
||||
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaCountRelease(JSArenaPool *pool, char *mark)
|
||||
{
|
||||
pool->stats.nreleases++;
|
||||
}
|
||||
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaCountRetract(JSArenaPool *pool, char *mark)
|
||||
{
|
||||
pool->stats.nfastrels++;
|
||||
}
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
IMPLEMENT(void)
|
||||
JS_DumpArenaStats(FILE *fp)
|
||||
{
|
||||
JSArenaStats *stats;
|
||||
double mean, variance;
|
||||
|
||||
for (stats = arena_stats_list; stats; stats = stats->next) {
|
||||
if (stats->nallocs != 0) {
|
||||
mean = (double)stats->nbytes / stats->nallocs;
|
||||
variance = fabs(stats->variance / stats->nallocs - mean * mean);
|
||||
} else {
|
||||
mean = variance = 0;
|
||||
}
|
||||
|
||||
fprintf(fp, "\n%s allocation statistics:\n", stats->name);
|
||||
fprintf(fp, " number of arenas: %u\n", stats->narenas);
|
||||
fprintf(fp, " number of allocations: %u\n", stats->nallocs);
|
||||
fprintf(fp, " number of free arena reclaims: %u\n", stats->nreclaims);
|
||||
fprintf(fp, " number of malloc calls: %u\n", stats->nmallocs);
|
||||
fprintf(fp, " number of deallocations: %u\n", stats->ndeallocs);
|
||||
fprintf(fp, " number of allocation growths: %u\n", stats->ngrows);
|
||||
fprintf(fp, " number of in-place growths: %u\n", stats->ninplace);
|
||||
fprintf(fp, "number of released allocations: %u\n", stats->nreleases);
|
||||
fprintf(fp, " number of fast releases: %u\n", stats->nfastrels);
|
||||
fprintf(fp, " total bytes allocated: %u\n", stats->nbytes);
|
||||
fprintf(fp, " mean allocation size: %g\n", mean);
|
||||
fprintf(fp, " standard deviation: %g\n", sqrt(variance));
|
||||
fprintf(fp, " maximum allocation size: %u\n", stats->maxalloc);
|
||||
}
|
||||
}
|
||||
#endif /* JS_ARENAMETER */
|
||||
246
mozilla/js/src/jsarena.h
Normal file
246
mozilla/js/src/jsarena.h
Normal file
@@ -0,0 +1,246 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef jsarena_h___
|
||||
#define jsarena_h___
|
||||
/*
|
||||
* Lifetime-based fast allocation, inspired by much prior art, including
|
||||
* "Fast Allocation and Deallocation of Memory Based on Object Lifetimes"
|
||||
* David R. Hanson, Software -- Practice and Experience, Vol. 20(1).
|
||||
*
|
||||
* Also supports LIFO allocation (JS_ARENA_MARK/JS_ARENA_RELEASE).
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#include "jscompat.h"
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
typedef struct JSArena JSArena;
|
||||
typedef struct JSArenaPool JSArenaPool;
|
||||
|
||||
struct JSArena {
|
||||
JSArena *next; /* next arena for this lifetime */
|
||||
jsuword base; /* aligned base address, follows this header */
|
||||
jsuword limit; /* one beyond last byte in arena */
|
||||
jsuword avail; /* points to next available byte */
|
||||
};
|
||||
|
||||
#ifdef JS_ARENAMETER
|
||||
typedef struct JSArenaStats JSArenaStats;
|
||||
|
||||
struct JSArenaStats {
|
||||
JSArenaStats *next; /* next in arenaStats list */
|
||||
char *name; /* name for debugging */
|
||||
uint32 narenas; /* number of arenas in pool */
|
||||
uint32 nallocs; /* number of JS_ARENA_ALLOCATE() calls */
|
||||
uint32 nreclaims; /* number of reclaims from freeArenas */
|
||||
uint32 nmallocs; /* number of malloc() calls */
|
||||
uint32 ndeallocs; /* number of lifetime deallocations */
|
||||
uint32 ngrows; /* number of JS_ARENA_GROW() calls */
|
||||
uint32 ninplace; /* number of in-place growths */
|
||||
uint32 nreleases; /* number of JS_ARENA_RELEASE() calls */
|
||||
uint32 nfastrels; /* number of "fast path" releases */
|
||||
size_t nbytes; /* total bytes allocated */
|
||||
size_t maxalloc; /* maximum allocation size in bytes */
|
||||
double variance; /* size variance accumulator */
|
||||
};
|
||||
#endif
|
||||
|
||||
struct JSArenaPool {
|
||||
JSArena first; /* first arena in pool list */
|
||||
JSArena *current; /* arena from which to allocate space */
|
||||
size_t arenasize; /* net exact size of a new arena */
|
||||
jsuword mask; /* alignment mask (power-of-2 - 1) */
|
||||
#ifdef JS_ARENAMETER
|
||||
JSArenaStats stats;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* If the including .c file uses only one power-of-2 alignment, it may define
|
||||
* JS_ARENA_CONST_ALIGN_MASK to the alignment mask and save a few instructions
|
||||
* per ALLOCATE and GROW.
|
||||
*/
|
||||
#ifdef JS_ARENA_CONST_ALIGN_MASK
|
||||
#define JS_ARENA_ALIGN(pool, n) (((jsuword)(n) + JS_ARENA_CONST_ALIGN_MASK) \
|
||||
& ~JS_ARENA_CONST_ALIGN_MASK)
|
||||
|
||||
#define JS_INIT_ARENA_POOL(pool, name, size) \
|
||||
JS_InitArenaPool(pool, name, size, JS_ARENA_CONST_ALIGN_MASK + 1)
|
||||
#else
|
||||
#define JS_ARENA_ALIGN(pool, n) (((jsuword)(n) + (pool)->mask) & ~(pool)->mask)
|
||||
#endif
|
||||
|
||||
#define JS_ARENA_ALLOCATE(p, pool, nb) \
|
||||
JS_BEGIN_MACRO \
|
||||
JSArena *_a = (pool)->current; \
|
||||
size_t _nb = JS_ARENA_ALIGN(pool, nb); \
|
||||
jsuword _p = _a->avail; \
|
||||
jsuword _q = _p + _nb; \
|
||||
if (_q > _a->limit) \
|
||||
_p = (jsuword)JS_ArenaAllocate(pool, _nb); \
|
||||
else \
|
||||
_a->avail = _q; \
|
||||
p = (void *)_p; \
|
||||
JS_ArenaCountAllocation(pool, nb); \
|
||||
JS_END_MACRO
|
||||
|
||||
#define JS_ARENA_GROW(p, pool, size, incr) \
|
||||
JS_BEGIN_MACRO \
|
||||
JSArena *_a = (pool)->current; \
|
||||
size_t _incr = JS_ARENA_ALIGN(pool, incr); \
|
||||
jsuword _p = _a->avail; \
|
||||
jsuword _q = _p + _incr; \
|
||||
if (_p == (jsuword)(p) + JS_ARENA_ALIGN(pool, size) && \
|
||||
_q <= _a->limit) { \
|
||||
_a->avail = _q; \
|
||||
JS_ArenaCountInplaceGrowth(pool, size, incr); \
|
||||
} else { \
|
||||
p = JS_ArenaGrow(pool, p, size, incr); \
|
||||
} \
|
||||
JS_ArenaCountGrowth(pool, size, incr); \
|
||||
JS_END_MACRO
|
||||
|
||||
#define JS_ARENA_MARK(pool) ((void *) (pool)->current->avail)
|
||||
#define JS_UPTRDIFF(p,q) ((jsuword)(p) - (jsuword)(q))
|
||||
|
||||
#ifdef DEBUG
|
||||
#define free_PATTERN 0xDA
|
||||
#define JS_CLEAR_UNUSED(a) (JS_ASSERT((a)->avail <= (a)->limit), \
|
||||
memset((void*)(a)->avail, free_PATTERN, \
|
||||
(a)->limit - (a)->avail))
|
||||
#define JS_CLEAR_ARENA(a) memset((void*)(a), free_PATTERN, \
|
||||
(a)->limit - (jsuword)(a))
|
||||
#else
|
||||
#define JS_CLEAR_UNUSED(a) /* nothing */
|
||||
#define JS_CLEAR_ARENA(a) /* nothing */
|
||||
#endif
|
||||
|
||||
#define JS_ARENA_RELEASE(pool, mark) \
|
||||
JS_BEGIN_MACRO \
|
||||
char *_m = (char *)(mark); \
|
||||
JSArena *_a = (pool)->current; \
|
||||
if (JS_UPTRDIFF(_m, _a) <= JS_UPTRDIFF(_a->avail, _a)) { \
|
||||
_a->avail = (jsuword)JS_ARENA_ALIGN(pool, _m); \
|
||||
JS_CLEAR_UNUSED(_a); \
|
||||
JS_ArenaCountRetract(pool, _m); \
|
||||
} else { \
|
||||
JS_ArenaRelease(pool, _m); \
|
||||
} \
|
||||
JS_ArenaCountRelease(pool, _m); \
|
||||
JS_END_MACRO
|
||||
|
||||
#ifdef JS_ARENAMETER
|
||||
#define JS_COUNT_ARENA(pool,op) ((pool)->stats.narenas op)
|
||||
#else
|
||||
#define JS_COUNT_ARENA(pool,op)
|
||||
#endif
|
||||
|
||||
#define JS_ARENA_DESTROY(pool, a, pnext) \
|
||||
JS_BEGIN_MACRO \
|
||||
JS_COUNT_ARENA(pool,--); \
|
||||
if ((pool)->current == (a)) (pool)->current = &(pool)->first; \
|
||||
*(pnext) = (a)->next; \
|
||||
JS_CLEAR_ARENA(a); \
|
||||
free(a); \
|
||||
(a) = NULL; \
|
||||
JS_END_MACRO
|
||||
|
||||
/*
|
||||
* Initialize an arena pool with the given name for debugging and metering,
|
||||
* with a minimum size per arena of size bytes.
|
||||
*/
|
||||
EXTERN(void)
|
||||
JS_InitArenaPool(JSArenaPool *pool, const char *name, JSUint32 size,
|
||||
JSUint32 align);
|
||||
|
||||
/*
|
||||
* Free the arenas in pool. The user may continue to allocate from pool
|
||||
* after calling this function. There is no need to call JS_InitArenaPool()
|
||||
* again unless JS_FinishArenaPool(pool) has been called.
|
||||
*/
|
||||
EXTERN(void)
|
||||
JS_FreeArenaPool(JSArenaPool *pool);
|
||||
|
||||
/*
|
||||
* Free the arenas in pool and finish using it altogether.
|
||||
*/
|
||||
EXTERN(void)
|
||||
JS_FinishArenaPool(JSArenaPool *pool);
|
||||
|
||||
/*
|
||||
* Compact all of the arenas in a pool so that no space is wasted.
|
||||
*/
|
||||
EXTERN(void)
|
||||
JS_CompactArenaPool(JSArenaPool *pool);
|
||||
|
||||
/*
|
||||
* Finish using arenas, freeing all memory associated with them.
|
||||
*/
|
||||
EXTERN(void)
|
||||
JS_ArenaFinish(void);
|
||||
|
||||
/*
|
||||
* Friend functions used by the JS_ARENA_*() macros.
|
||||
*/
|
||||
EXTERN(void *)
|
||||
JS_ArenaAllocate(JSArenaPool *pool, JSUint32 nb);
|
||||
|
||||
EXTERN(void *)
|
||||
JS_ArenaGrow(JSArenaPool *pool, void *p, JSUint32 size, JSUint32 incr);
|
||||
|
||||
EXTERN(void)
|
||||
JS_ArenaRelease(JSArenaPool *pool, char *mark);
|
||||
|
||||
#ifdef JS_ARENAMETER
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
EXTERN(void)
|
||||
JS_ArenaCountAllocation(JSArenaPool *pool, JSUint32 nb);
|
||||
|
||||
EXTERN(void)
|
||||
JS_ArenaCountInplaceGrowth(JSArenaPool *pool, JSUint32 size, JSUint32 incr);
|
||||
|
||||
EXTERN(void)
|
||||
JS_ArenaCountGrowth(JSArenaPool *pool, JSUint32 size, JSUint32incr);
|
||||
|
||||
EXTERN(void)
|
||||
JS_ArenaCountRelease(JSArenaPool *pool, char *mark);
|
||||
|
||||
EXTERN(void)
|
||||
JS_ArenaCountRetract(JSArenaPool *pool, char *mark);
|
||||
|
||||
EXTERN(void)
|
||||
JS_DumpArenaStats(FILE *fp);
|
||||
|
||||
#else /* !JS_ARENAMETER */
|
||||
|
||||
#define JS_ArenaCountAllocation(ap, nb) /* nothing */
|
||||
#define JS_ArenaCountInplaceGrowth(ap, size, incr) /* nothing */
|
||||
#define JS_ArenaCountGrowth(ap, size, incr) /* nothing */
|
||||
#define JS_ArenaCountRelease(ap, mark) /* nothing */
|
||||
#define JS_ArenaCountRetract(ap, mark) /* nothing */
|
||||
|
||||
#endif /* !JS_ARENAMETER */
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
#endif /* jsarena_h___ */
|
||||
1300
mozilla/js/src/jsarray.c
Normal file
1300
mozilla/js/src/jsarray.c
Normal file
File diff suppressed because it is too large
Load Diff
56
mozilla/js/src/jsarray.h
Normal file
56
mozilla/js/src/jsarray.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef jsarray_h___
|
||||
#define jsarray_h___
|
||||
/*
|
||||
* JS Array interface.
|
||||
*/
|
||||
#include "jsprvtd.h"
|
||||
#include "jspubtd.h"
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
extern JSClass js_ArrayClass;
|
||||
|
||||
extern JSObject *
|
||||
js_InitArrayClass(JSContext *cx, JSObject *obj);
|
||||
|
||||
extern JSObject *
|
||||
js_NewArrayObject(JSContext *cx, jsuint length, jsval *vector);
|
||||
|
||||
extern JSBool
|
||||
js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp);
|
||||
|
||||
extern JSBool
|
||||
js_SetLengthProperty(JSContext *cx, JSObject *obj, jsuint length);
|
||||
|
||||
extern JSBool
|
||||
js_HasLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp);
|
||||
|
||||
/*
|
||||
* JS-specific qsort function.
|
||||
*/
|
||||
typedef int (*JSComparator)(const void *a, const void *b, void *arg);
|
||||
|
||||
extern JSBool
|
||||
js_qsort(void *vec, size_t nel, size_t elsize, JSComparator cmp, void *arg);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
#endif /* jsarray_h___ */
|
||||
672
mozilla/js/src/jsatom.c
Normal file
672
mozilla/js/src/jsatom.c
Normal file
@@ -0,0 +1,672 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* JS atom table.
|
||||
*/
|
||||
#include "jsstddef.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
#include "jsprf.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsatom.h"
|
||||
#include "jscntxt.h"
|
||||
#include "jsgc.h"
|
||||
#include "jslock.h"
|
||||
#include "jsnum.h"
|
||||
#include "jsopcode.h"
|
||||
#include "jsstr.h"
|
||||
|
||||
/*
|
||||
* Keep this in sync with jspubtd.h -- an assertion below will insist that
|
||||
* its length match the JSType enum's JSTYPE_LIMIT limit value.
|
||||
*/
|
||||
char *js_type_str[] = {
|
||||
"undefined",
|
||||
"object",
|
||||
"function",
|
||||
"string",
|
||||
"number",
|
||||
"boolean",
|
||||
};
|
||||
|
||||
char *js_boolean_str[] = {
|
||||
js_false_str,
|
||||
js_true_str
|
||||
};
|
||||
|
||||
char js_Array_str[] = "Array";
|
||||
char js_Math_str[] = "Math";
|
||||
char js_Object_str[] = "Object";
|
||||
char js_anonymous_str[] = "anonymous";
|
||||
char js_arguments_str[] = "arguments";
|
||||
char js_arity_str[] = "arity";
|
||||
char js_assign_str[] = "assign";
|
||||
char js_callee_str[] = "callee";
|
||||
char js_caller_str[] = "caller";
|
||||
char js_class_prototype_str[] = "prototype";
|
||||
char js_constructor_str[] = "constructor";
|
||||
char js_count_str[] = "__count__";
|
||||
char js_eval_str[] = "eval";
|
||||
char js_index_str[] = "index";
|
||||
char js_input_str[] = "input";
|
||||
char js_length_str[] = "length";
|
||||
char js_name_str[] = "name";
|
||||
char js_parent_str[] = "__parent__";
|
||||
char js_proto_str[] = "__proto__";
|
||||
char js_toSource_str[] = "toSource";
|
||||
char js_toString_str[] = "toString";
|
||||
char js_valueOf_str[] = "valueOf";
|
||||
|
||||
#define HASH_OBJECT(o) ((JSHashNumber)(o) >> JSVAL_TAGBITS)
|
||||
#define HASH_INT(i) ((JSHashNumber)(i))
|
||||
#define HASH_DOUBLE(dp) ((JSHashNumber)(((uint32*)(dp))[0] ^ ((uint32*)(dp))[1]))
|
||||
#define HASH_BOOLEAN(b) ((JSHashNumber)(b))
|
||||
|
||||
STATIC_DLL_CALLBACK(JSHashNumber)
|
||||
js_hash_atom_key(const void *key)
|
||||
{
|
||||
jsval v;
|
||||
jsdouble *dp;
|
||||
|
||||
/* Order JSVAL_IS_* tests by likelihood of success. */
|
||||
v = (jsval)key;
|
||||
if (JSVAL_IS_STRING(v))
|
||||
return js_HashString(JSVAL_TO_STRING(v));
|
||||
if (JSVAL_IS_INT(v))
|
||||
return HASH_INT(JSVAL_TO_INT(v));
|
||||
if (JSVAL_IS_DOUBLE(v)) {
|
||||
dp = JSVAL_TO_DOUBLE(v);
|
||||
return HASH_DOUBLE(dp);
|
||||
}
|
||||
if (JSVAL_IS_OBJECT(v))
|
||||
return HASH_OBJECT(JSVAL_TO_OBJECT(v));
|
||||
if (JSVAL_IS_BOOLEAN(v))
|
||||
return HASH_BOOLEAN(JSVAL_TO_BOOLEAN(v));
|
||||
return (JSHashNumber)v;
|
||||
}
|
||||
|
||||
STATIC_DLL_CALLBACK(intN)
|
||||
js_compare_atom_keys(const void *k1, const void *k2)
|
||||
{
|
||||
jsval v1, v2;
|
||||
|
||||
v1 = (jsval)k1, v2 = (jsval)k2;
|
||||
if (JSVAL_IS_STRING(v1) && JSVAL_IS_STRING(v2))
|
||||
return !js_CompareStrings(JSVAL_TO_STRING(v1), JSVAL_TO_STRING(v2));
|
||||
if (JSVAL_IS_DOUBLE(v1) && JSVAL_IS_DOUBLE(v2)) {
|
||||
double d1 = *JSVAL_TO_DOUBLE(v1);
|
||||
double d2 = *JSVAL_TO_DOUBLE(v2);
|
||||
if (JSDOUBLE_IS_NaN(d1))
|
||||
return JSDOUBLE_IS_NaN(d2);
|
||||
#ifdef XP_PC
|
||||
/* XXX MSVC miscompiles such that (NaN == 0) */
|
||||
if (JSDOUBLE_IS_NaN(d2))
|
||||
return JS_FALSE;
|
||||
#endif
|
||||
return d1 == d2;
|
||||
}
|
||||
return v1 == v2;
|
||||
}
|
||||
|
||||
STATIC_DLL_CALLBACK(int)
|
||||
js_compare_stub(const void *v1, const void *v2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
STATIC_DLL_CALLBACK(void *)
|
||||
js_alloc_atom_space(void *priv, size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
STATIC_DLL_CALLBACK(void)
|
||||
js_free_atom_space(void *priv, void *item)
|
||||
{
|
||||
free(item);
|
||||
}
|
||||
|
||||
STATIC_DLL_CALLBACK(JSHashEntry *)
|
||||
js_alloc_atom(void *priv, const void *key)
|
||||
{
|
||||
JSAtomState *state = priv;
|
||||
JSAtom *atom;
|
||||
|
||||
atom = malloc(sizeof(JSAtom));
|
||||
if (!atom)
|
||||
return NULL;
|
||||
#ifdef JS_THREADSAFE
|
||||
state->tablegen++;
|
||||
#endif
|
||||
atom->entry.key = key;
|
||||
atom->entry.value = NULL;
|
||||
atom->flags = 0;
|
||||
atom->kwindex = -1;
|
||||
atom->number = state->number++;
|
||||
return &atom->entry;
|
||||
}
|
||||
|
||||
STATIC_DLL_CALLBACK(void)
|
||||
js_free_atom(void *priv, JSHashEntry *he, uintN flag)
|
||||
{
|
||||
if (flag != HT_FREE_ENTRY)
|
||||
return;
|
||||
#ifdef JS_THREADSAFE
|
||||
((JSAtomState *)priv)->tablegen++;
|
||||
#endif
|
||||
free(he);
|
||||
}
|
||||
|
||||
static JSHashAllocOps atom_alloc_ops = {
|
||||
js_alloc_atom_space, js_free_atom_space,
|
||||
js_alloc_atom, js_free_atom
|
||||
};
|
||||
|
||||
#define JS_ATOM_HASH_SIZE 1024
|
||||
|
||||
JSBool
|
||||
js_InitAtomState(JSContext *cx, JSAtomState *state)
|
||||
{
|
||||
uintN i;
|
||||
|
||||
state->runtime = cx->runtime;
|
||||
state->number = 0;
|
||||
state->table = JS_NewHashTable(JS_ATOM_HASH_SIZE, js_hash_atom_key,
|
||||
js_compare_atom_keys, js_compare_stub,
|
||||
&atom_alloc_ops, state);
|
||||
if (!state->table) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return JS_FALSE;
|
||||
}
|
||||
#ifdef JS_THREADSAFE
|
||||
js_NewLock(&state->lock);
|
||||
state->tablegen = 0;
|
||||
#endif
|
||||
|
||||
#define FROB(lval,str) { \
|
||||
if (!(state->lval = js_Atomize(cx, str, strlen(str), ATOM_PINNED))) { \
|
||||
js_FreeAtomState(cx, state); \
|
||||
return JS_FALSE; \
|
||||
} \
|
||||
}
|
||||
|
||||
JS_ASSERT(sizeof js_type_str / sizeof js_type_str[0] == JSTYPE_LIMIT);
|
||||
for (i = 0; i < JSTYPE_LIMIT; i++)
|
||||
FROB(typeAtoms[i], js_type_str[i]);
|
||||
|
||||
FROB(booleanAtoms[0], js_false_str);
|
||||
FROB(booleanAtoms[1], js_true_str);
|
||||
FROB(nullAtom, js_null_str);
|
||||
|
||||
FROB(ArrayAtom, js_Array_str);
|
||||
FROB(MathAtom, js_Math_str);
|
||||
FROB(ObjectAtom, js_Object_str);
|
||||
FROB(anonymousAtom, js_anonymous_str);
|
||||
FROB(argumentsAtom, js_arguments_str);
|
||||
FROB(arityAtom, js_arity_str);
|
||||
FROB(assignAtom, js_assign_str);
|
||||
FROB(calleeAtom, js_callee_str);
|
||||
FROB(callerAtom, js_caller_str);
|
||||
FROB(classPrototypeAtom, js_class_prototype_str);
|
||||
FROB(constructorAtom, js_constructor_str);
|
||||
FROB(countAtom, js_count_str);
|
||||
FROB(indexAtom, js_index_str);
|
||||
FROB(inputAtom, js_input_str);
|
||||
FROB(lengthAtom, js_length_str);
|
||||
FROB(nameAtom, js_name_str);
|
||||
FROB(parentAtom, js_parent_str);
|
||||
FROB(protoAtom, js_proto_str);
|
||||
FROB(toSourceAtom, js_toSource_str);
|
||||
FROB(toStringAtom, js_toString_str);
|
||||
FROB(valueOfAtom, js_valueOf_str);
|
||||
|
||||
#undef FROB
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
js_FreeAtomState(JSContext *cx, JSAtomState *state)
|
||||
{
|
||||
state->runtime = NULL;
|
||||
JS_HashTableDestroy(state->table);
|
||||
state->table = NULL;
|
||||
state->number = 0;
|
||||
#ifdef JS_THREADSAFE
|
||||
js_DestroyLock(&state->lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
typedef struct MarkArgs {
|
||||
JSRuntime *runtime;
|
||||
JSGCThingMarker mark;
|
||||
} MarkArgs;
|
||||
|
||||
STATIC_DLL_CALLBACK(intN)
|
||||
js_atom_marker(JSHashEntry *he, intN i, void *arg)
|
||||
{
|
||||
JSAtom *atom;
|
||||
jsval key;
|
||||
MarkArgs *args;
|
||||
|
||||
atom = (JSAtom *)he;
|
||||
if (atom->flags & ATOM_PINNED) {
|
||||
atom->flags |= ATOM_MARK;
|
||||
key = ATOM_KEY(atom);
|
||||
if (JSVAL_IS_GCTHING(key)) {
|
||||
args = arg;
|
||||
args->mark(args->runtime, JSVAL_TO_GCTHING(key));
|
||||
}
|
||||
}
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
js_MarkAtomState(JSAtomState *state, JSGCThingMarker mark)
|
||||
{
|
||||
MarkArgs args;
|
||||
|
||||
args.runtime = state->runtime;
|
||||
args.mark = mark;
|
||||
JS_HashTableEnumerateEntries(state->table, js_atom_marker, &args);
|
||||
}
|
||||
|
||||
STATIC_DLL_CALLBACK(intN)
|
||||
js_atom_sweeper(JSHashEntry *he, intN i, void *arg)
|
||||
{
|
||||
JSAtom *atom;
|
||||
|
||||
atom = (JSAtom *)he;
|
||||
if (atom->flags & ATOM_MARK) {
|
||||
atom->flags &= ~ATOM_MARK;
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
JS_ASSERT((atom->flags & ATOM_PINNED) == 0);
|
||||
atom->entry.key = NULL;
|
||||
atom->flags = 0;
|
||||
return HT_ENUMERATE_REMOVE;
|
||||
}
|
||||
|
||||
void
|
||||
js_SweepAtomState(JSAtomState *state)
|
||||
{
|
||||
JS_HashTableEnumerateEntries(state->table, js_atom_sweeper, NULL);
|
||||
}
|
||||
|
||||
STATIC_DLL_CALLBACK(intN)
|
||||
js_atom_unpinner(JSHashEntry *he, intN i, void *arg)
|
||||
{
|
||||
JSAtom *atom;
|
||||
|
||||
atom = (JSAtom *)he;
|
||||
atom->flags &= ~ATOM_PINNED;
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
js_UnpinPinnedAtoms(JSAtomState *state)
|
||||
{
|
||||
JS_HashTableEnumerateEntries(state->table, js_atom_unpinner, NULL);
|
||||
}
|
||||
|
||||
static JSAtom *
|
||||
js_AtomizeHashedKey(JSContext *cx, jsval key, JSHashNumber keyHash, uintN flags)
|
||||
{
|
||||
JSAtomState *state;
|
||||
JSHashTable *table;
|
||||
JSHashEntry *he, **hep;
|
||||
JSAtom *atom;
|
||||
|
||||
state = &cx->runtime->atomState;
|
||||
JS_LOCK(&state->lock,cx);
|
||||
table = state->table;
|
||||
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
|
||||
if ((he = *hep) == NULL) {
|
||||
he = JS_HashTableRawAdd(table, hep, keyHash, (void *)key, NULL);
|
||||
if (!he) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
atom = NULL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
atom = (JSAtom *)he;
|
||||
atom->flags |= flags;
|
||||
out:
|
||||
JS_UNLOCK(&state->lock,cx);
|
||||
return atom;
|
||||
}
|
||||
|
||||
JSAtom *
|
||||
js_AtomizeObject(JSContext *cx, JSObject *obj, uintN flags)
|
||||
{
|
||||
jsval key;
|
||||
JSHashNumber keyHash;
|
||||
|
||||
/* XXX must be set in the following order or MSVC1.52 will crash */
|
||||
keyHash = HASH_OBJECT(obj);
|
||||
key = OBJECT_TO_JSVAL(obj);
|
||||
return js_AtomizeHashedKey(cx, key, keyHash, flags);
|
||||
}
|
||||
|
||||
JSAtom *
|
||||
js_AtomizeBoolean(JSContext *cx, JSBool b, uintN flags)
|
||||
{
|
||||
jsval key;
|
||||
JSHashNumber keyHash;
|
||||
|
||||
key = BOOLEAN_TO_JSVAL(b);
|
||||
keyHash = HASH_BOOLEAN(b);
|
||||
return js_AtomizeHashedKey(cx, key, keyHash, flags);
|
||||
}
|
||||
|
||||
JSAtom *
|
||||
js_AtomizeInt(JSContext *cx, jsint i, uintN flags)
|
||||
{
|
||||
jsval key;
|
||||
JSHashNumber keyHash;
|
||||
|
||||
key = INT_TO_JSVAL(i);
|
||||
keyHash = HASH_INT(i);
|
||||
return js_AtomizeHashedKey(cx, key, keyHash, flags);
|
||||
}
|
||||
|
||||
JSAtom *
|
||||
js_AtomizeDouble(JSContext *cx, jsdouble d, uintN flags)
|
||||
{
|
||||
jsdouble *dp;
|
||||
JSHashNumber keyHash;
|
||||
jsval key;
|
||||
JSAtomState *state;
|
||||
JSHashTable *table;
|
||||
JSHashEntry *he, **hep;
|
||||
JSAtom *atom;
|
||||
|
||||
#if JS_ALIGN_OF_DOUBLE == 8
|
||||
dp = &d;
|
||||
#else
|
||||
char alignbuf[16];
|
||||
|
||||
dp = (jsdouble *)&alignbuf[8 - ((jsuword)&alignbuf & 7)];
|
||||
*dp = d;
|
||||
#endif
|
||||
|
||||
keyHash = HASH_DOUBLE(dp);
|
||||
key = DOUBLE_TO_JSVAL(dp);
|
||||
state = &cx->runtime->atomState;
|
||||
JS_LOCK(&state->lock,cx);
|
||||
table = state->table;
|
||||
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
|
||||
if ((he = *hep) == NULL) {
|
||||
#ifdef JS_THREADSAFE
|
||||
uint32 gen = state->tablegen;
|
||||
#endif
|
||||
JS_UNLOCK(&state->lock,cx);
|
||||
if (!js_NewDoubleValue(cx, d, &key))
|
||||
return NULL;
|
||||
JS_LOCK(&state->lock,cx);
|
||||
#ifdef JS_THREADSAFE
|
||||
if (state->tablegen != gen) {
|
||||
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
|
||||
if ((he = *hep) != NULL) {
|
||||
atom = (JSAtom *)he;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
he = JS_HashTableRawAdd(table, hep, keyHash, (void *)key, NULL);
|
||||
if (!he) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
atom = NULL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
atom = (JSAtom *)he;
|
||||
atom->flags |= flags;
|
||||
out:
|
||||
JS_UNLOCK(&state->lock,cx);
|
||||
return atom;
|
||||
}
|
||||
|
||||
JSAtom *
|
||||
js_AtomizeString(JSContext *cx, JSString *str, uintN flags)
|
||||
{
|
||||
JSHashNumber keyHash;
|
||||
jsval key;
|
||||
JSAtomState *state;
|
||||
JSHashTable *table;
|
||||
JSHashEntry *he, **hep;
|
||||
JSAtom *atom;
|
||||
|
||||
keyHash = js_HashString(str);
|
||||
key = STRING_TO_JSVAL(str);
|
||||
state = &cx->runtime->atomState;
|
||||
JS_LOCK(&state->lock,cx);
|
||||
table = state->table;
|
||||
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
|
||||
if ((he = *hep) == NULL) {
|
||||
if (flags & ATOM_TMPSTR) {
|
||||
#ifdef JS_THREADSAFE
|
||||
uint32 gen = state->tablegen;
|
||||
#endif
|
||||
JS_UNLOCK(&state->lock,cx);
|
||||
flags &= ~ATOM_TMPSTR;
|
||||
if (flags & ATOM_NOCOPY) {
|
||||
flags &= ~ATOM_NOCOPY;
|
||||
str = js_NewString(cx, str->chars, str->length, 0);
|
||||
} else {
|
||||
str = js_NewStringCopyN(cx, str->chars, str->length, 0);
|
||||
}
|
||||
if (!str)
|
||||
return NULL;
|
||||
key = STRING_TO_JSVAL(str);
|
||||
JS_LOCK(&state->lock,cx);
|
||||
#ifdef JS_THREADSAFE
|
||||
if (state->tablegen != gen) {
|
||||
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
|
||||
if ((he = *hep) != NULL) {
|
||||
atom = (JSAtom *)he;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
he = JS_HashTableRawAdd(table, hep, keyHash, (void *)key, NULL);
|
||||
if (!he) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
atom = NULL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
atom = (JSAtom *)he;
|
||||
atom->flags |= flags;
|
||||
out:
|
||||
JS_UNLOCK(&state->lock,cx);
|
||||
return atom;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSAtom *)
|
||||
js_Atomize(JSContext *cx, const char *bytes, size_t length, uintN flags)
|
||||
{
|
||||
jschar *chars;
|
||||
JSString *str;
|
||||
JSAtom *atom;
|
||||
#if JS_ALIGN_OF_DOUBLE == 8
|
||||
union { jsdouble d; JSString s; } u;
|
||||
|
||||
str = &u.s;
|
||||
#else
|
||||
char alignbuf[16];
|
||||
|
||||
str = (JSString *)&alignbuf[8 - ((jsuword)&alignbuf & 7)];
|
||||
#endif
|
||||
|
||||
chars = js_InflateString(cx, bytes, length);
|
||||
if (!chars)
|
||||
return NULL;
|
||||
str->chars = chars;
|
||||
str->length = length;
|
||||
atom = js_AtomizeString(cx, str, ATOM_TMPSTR | ATOM_NOCOPY | flags);
|
||||
if (!atom || ATOM_TO_STRING(atom)->chars != chars)
|
||||
JS_free(cx, chars);
|
||||
return atom;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSAtom *)
|
||||
js_AtomizeChars(JSContext *cx, const jschar *chars, size_t length, uintN flags)
|
||||
{
|
||||
JSString *str;
|
||||
#if JS_ALIGN_OF_DOUBLE == 8
|
||||
union { jsdouble d; JSString s; } u;
|
||||
|
||||
str = &u.s;
|
||||
#else
|
||||
char alignbuf[16];
|
||||
|
||||
str = (JSString *)&alignbuf[8 - ((jsuword)&alignbuf & 7)];
|
||||
#endif
|
||||
|
||||
str->chars = (jschar *)chars;
|
||||
str->length = length;
|
||||
return js_AtomizeString(cx, str, ATOM_TMPSTR | flags);
|
||||
}
|
||||
|
||||
JSAtom *
|
||||
js_AtomizeValue(JSContext *cx, jsval value, uintN flags)
|
||||
{
|
||||
if (JSVAL_IS_STRING(value))
|
||||
return js_AtomizeString(cx, JSVAL_TO_STRING(value), flags);
|
||||
if (JSVAL_IS_INT(value))
|
||||
return js_AtomizeInt(cx, JSVAL_TO_INT(value), flags);
|
||||
if (JSVAL_IS_DOUBLE(value))
|
||||
return js_AtomizeDouble(cx, *JSVAL_TO_DOUBLE(value), flags);
|
||||
if (JSVAL_IS_OBJECT(value))
|
||||
return js_AtomizeObject(cx, JSVAL_TO_OBJECT(value), flags);
|
||||
if (JSVAL_IS_BOOLEAN(value))
|
||||
return js_AtomizeBoolean(cx, JSVAL_TO_BOOLEAN(value), flags);
|
||||
return js_AtomizeHashedKey(cx, value, (JSHashNumber)value, flags);
|
||||
}
|
||||
|
||||
JSAtom *
|
||||
js_ValueToStringAtom(JSContext *cx, jsval v)
|
||||
{
|
||||
JSString *str;
|
||||
|
||||
str = js_ValueToString(cx, v);
|
||||
if (!str)
|
||||
return NULL;
|
||||
return js_AtomizeString(cx, str, 0);
|
||||
}
|
||||
|
||||
JSAtomListElement *
|
||||
js_IndexAtom(JSContext *cx, JSAtom *atom, JSAtomList *al)
|
||||
{
|
||||
JSAtomListElement *ale;
|
||||
|
||||
ATOM_LIST_SEARCH(ale, al, atom);
|
||||
if (!ale) {
|
||||
JS_ARENA_ALLOCATE(ale, &cx->tempPool, sizeof(JSAtomListElement));
|
||||
if (!ale) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return NULL;
|
||||
}
|
||||
ale->atom = atom;
|
||||
ale->index = (jsatomid) al->count++;
|
||||
ale->next = al->list;
|
||||
al->list = ale;
|
||||
}
|
||||
return ale;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSAtom *)
|
||||
js_GetAtom(JSContext *cx, JSAtomMap *map, jsatomid i)
|
||||
{
|
||||
JSAtom *atom;
|
||||
|
||||
JS_ASSERT(map->vector && i < map->length);
|
||||
if (!map->vector || i >= map->length) {
|
||||
char numBuf[12];
|
||||
JS_snprintf(numBuf, sizeof numBuf, "%lu", (unsigned long)i);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_BAD_ATOMIC_NUMBER, numBuf);
|
||||
return NULL;
|
||||
}
|
||||
atom = map->vector[i];
|
||||
JS_ASSERT(atom);
|
||||
return atom;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSBool)
|
||||
js_InitAtomMap(JSContext *cx, JSAtomMap *map, JSAtomList *al)
|
||||
{
|
||||
JSAtom **vector;
|
||||
JSAtomListElement *ale, *next;
|
||||
uint32 count;
|
||||
|
||||
ale = al->list;
|
||||
if (!ale) {
|
||||
map->vector = NULL;
|
||||
map->length = 0;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
count = al->count;
|
||||
if (count >= ATOM_INDEX_LIMIT) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_TOO_MANY_LITERALS);
|
||||
return JS_FALSE;
|
||||
}
|
||||
vector = JS_malloc(cx, (size_t) count * sizeof *vector);
|
||||
if (!vector)
|
||||
return JS_FALSE;
|
||||
|
||||
do {
|
||||
vector[ale->index] = ale->atom;
|
||||
next = ale->next;
|
||||
ale->next = NULL;
|
||||
} while ((ale = next) != NULL);
|
||||
al->list = NULL;
|
||||
al->count = 0;
|
||||
|
||||
map->vector = vector;
|
||||
map->length = (jsatomid)count;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_FreeAtomMap(JSContext *cx, JSAtomMap *map)
|
||||
{
|
||||
if (map->vector) {
|
||||
free(map->vector);
|
||||
map->vector = NULL;
|
||||
}
|
||||
map->length = 0;
|
||||
}
|
||||
278
mozilla/js/src/jsatom.h
Normal file
278
mozilla/js/src/jsatom.h
Normal file
@@ -0,0 +1,278 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef jsatom_h___
|
||||
#define jsatom_h___
|
||||
/*
|
||||
* JS atom table.
|
||||
*/
|
||||
#include <stddef.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
#include "jsapi.h"
|
||||
#include "jsprvtd.h"
|
||||
#include "jspubtd.h"
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
#include "jslock.h"
|
||||
#endif
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
#define ATOM_NOCOPY 0x01 /* don't copy atom string bytes */
|
||||
#define ATOM_TMPSTR 0x02 /* internal, to avoid extra string */
|
||||
#define ATOM_MARK 0x04 /* atom is reachable via GC */
|
||||
#define ATOM_PINNED 0x08 /* atom is pinned against GC */
|
||||
|
||||
struct JSAtom {
|
||||
JSHashEntry entry; /* key is jsval, value keyword info */
|
||||
uint8 flags; /* flags, PINNED and/or MARK for now */
|
||||
int8 kwindex; /* keyword index, -1 if not keyword */
|
||||
jsatomid number; /* atom serial number and hash code */
|
||||
};
|
||||
|
||||
#define ATOM_KEY(atom) ((jsval)(atom)->entry.key)
|
||||
#define ATOM_IS_OBJECT(atom) JSVAL_IS_OBJECT(ATOM_KEY(atom))
|
||||
#define ATOM_TO_OBJECT(atom) JSVAL_TO_OBJECT(ATOM_KEY(atom))
|
||||
#define ATOM_IS_INT(atom) JSVAL_IS_INT(ATOM_KEY(atom))
|
||||
#define ATOM_TO_INT(atom) JSVAL_TO_INT(ATOM_KEY(atom))
|
||||
#define ATOM_IS_DOUBLE(atom) JSVAL_IS_DOUBLE(ATOM_KEY(atom))
|
||||
#define ATOM_TO_DOUBLE(atom) JSVAL_TO_DOUBLE(ATOM_KEY(atom))
|
||||
#define ATOM_IS_STRING(atom) JSVAL_IS_STRING(ATOM_KEY(atom))
|
||||
#define ATOM_TO_STRING(atom) JSVAL_TO_STRING(ATOM_KEY(atom))
|
||||
#define ATOM_IS_BOOLEAN(atom) JSVAL_IS_BOOLEAN(ATOM_KEY(atom))
|
||||
#define ATOM_TO_BOOLEAN(atom) JSVAL_TO_BOOLEAN(ATOM_KEY(atom))
|
||||
#define ATOM_BYTES(atom) JS_GetStringBytes(ATOM_TO_STRING(atom))
|
||||
|
||||
struct JSAtomListElement {
|
||||
JSAtomListElement *next;
|
||||
jsatomid index; /* index in script-specific atom map */
|
||||
JSAtom *atom;
|
||||
};
|
||||
|
||||
struct JSAtomList {
|
||||
JSAtomListElement *list; /* literals indexed for mapping */
|
||||
jsuint count; /* count of indexed literals */
|
||||
};
|
||||
|
||||
#define ATOM_LIST_INIT(al) ((al)->list = NULL, (al)->count = 0)
|
||||
|
||||
#define ATOM_LIST_SEARCH(_ale,_al,_atom) \
|
||||
JS_BEGIN_MACRO \
|
||||
JSAtomListElement **_alep = &(_al)->list; \
|
||||
while ((_ale = *_alep) != NULL) { \
|
||||
if (_ale->atom == (_atom)) { \
|
||||
/* Hit, move atom's element to the front of the list. */ \
|
||||
*_alep = _ale->next; \
|
||||
_ale->next = (_al)->list; \
|
||||
(_al)->list = _ale; \
|
||||
break; \
|
||||
} \
|
||||
_alep = &_ale->next; \
|
||||
} \
|
||||
JS_END_MACRO
|
||||
|
||||
struct JSAtomMap {
|
||||
JSAtom **vector; /* array of ptrs to indexed atoms */
|
||||
jsatomid length; /* count of (to-be-)indexed atoms */
|
||||
};
|
||||
|
||||
struct JSAtomState {
|
||||
JSRuntime *runtime; /* runtime that owns us */
|
||||
JSHashTable *table; /* hash table containing all atoms */
|
||||
jsatomid number; /* one beyond greatest atom number */
|
||||
|
||||
/* Type names and value literals. */
|
||||
JSAtom *typeAtoms[JSTYPE_LIMIT];
|
||||
JSAtom *booleanAtoms[2];
|
||||
JSAtom *nullAtom;
|
||||
|
||||
/* Various built-in or commonly-used atoms. */
|
||||
JSAtom *ArrayAtom;
|
||||
JSAtom *MathAtom;
|
||||
JSAtom *ObjectAtom;
|
||||
JSAtom *anonymousAtom;
|
||||
JSAtom *argumentsAtom;
|
||||
JSAtom *arityAtom;
|
||||
JSAtom *assignAtom;
|
||||
JSAtom *calleeAtom;
|
||||
JSAtom *callerAtom;
|
||||
JSAtom *classPrototypeAtom;
|
||||
JSAtom *constructorAtom;
|
||||
JSAtom *countAtom;
|
||||
JSAtom *indexAtom;
|
||||
JSAtom *inputAtom;
|
||||
JSAtom *lengthAtom;
|
||||
JSAtom *nameAtom;
|
||||
JSAtom *parentAtom;
|
||||
JSAtom *protoAtom;
|
||||
JSAtom *toSourceAtom;
|
||||
JSAtom *toStringAtom;
|
||||
JSAtom *valueOfAtom;
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
JSThinLock lock;
|
||||
volatile uint32 tablegen;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Well-known predefined strings and their atoms. */
|
||||
extern char *js_type_str[];
|
||||
extern char *js_boolean_str[];
|
||||
|
||||
extern char js_Array_str[];
|
||||
extern char js_Math_str[];
|
||||
extern char js_Object_str[];
|
||||
extern char js_anonymous_str[];
|
||||
extern char js_arguments_str[];
|
||||
extern char js_arity_str[];
|
||||
extern char js_assign_str[];
|
||||
extern char js_callee_str[];
|
||||
extern char js_caller_str[];
|
||||
extern char js_class_prototype_str[];
|
||||
extern char js_constructor_str[];
|
||||
extern char js_count_str[];
|
||||
extern char js_eval_str[];
|
||||
extern char js_index_str[];
|
||||
extern char js_input_str[];
|
||||
extern char js_length_str[];
|
||||
extern char js_name_str[];
|
||||
extern char js_parent_str[];
|
||||
extern char js_proto_str[];
|
||||
extern char js_toSource_str[];
|
||||
extern char js_toString_str[];
|
||||
extern char js_valueOf_str[];
|
||||
|
||||
/*
|
||||
* Initialize atom state. Return true on success, false with an out of
|
||||
* memory error report on failure.
|
||||
*/
|
||||
extern JSBool
|
||||
js_InitAtomState(JSContext *cx, JSAtomState *state);
|
||||
|
||||
/*
|
||||
* Free and clear atom state.
|
||||
*/
|
||||
extern void
|
||||
js_FreeAtomState(JSContext *cx, JSAtomState *state);
|
||||
|
||||
/*
|
||||
* Atom garbage collection hooks.
|
||||
*/
|
||||
typedef void
|
||||
(*JSGCThingMarker)(JSRuntime *rt, void *thing);
|
||||
|
||||
extern void
|
||||
js_MarkAtomState(JSAtomState *state, JSGCThingMarker mark);
|
||||
|
||||
extern void
|
||||
js_SweepAtomState(JSAtomState *state);
|
||||
|
||||
extern void
|
||||
js_UnpinPinnedAtoms(JSAtomState *state);
|
||||
|
||||
/*
|
||||
* Find or create the atom for an object. If we create a new atom, give it the
|
||||
* type indicated in flags. Return 0 on failure to allocate memory.
|
||||
*/
|
||||
extern JSAtom *
|
||||
js_AtomizeObject(JSContext *cx, JSObject *obj, uintN flags);
|
||||
|
||||
/*
|
||||
* Find or create the atom for a Boolean value. If we create a new atom, give
|
||||
* it the type indicated in flags. Return 0 on failure to allocate memory.
|
||||
*/
|
||||
extern JSAtom *
|
||||
js_AtomizeBoolean(JSContext *cx, JSBool b, uintN flags);
|
||||
|
||||
/*
|
||||
* Find or create the atom for an integer value. If we create a new atom, give
|
||||
* it the type indicated in flags. Return 0 on failure to allocate memory.
|
||||
*/
|
||||
extern JSAtom *
|
||||
js_AtomizeInt(JSContext *cx, jsint i, uintN flags);
|
||||
|
||||
/*
|
||||
* Find or create the atom for a double value. If we create a new atom, give
|
||||
* it the type indicated in flags. Return 0 on failure to allocate memory.
|
||||
*/
|
||||
extern JSAtom *
|
||||
js_AtomizeDouble(JSContext *cx, jsdouble d, uintN flags);
|
||||
|
||||
/*
|
||||
* Find or create the atom for a string. If we create a new atom, give it the
|
||||
* type indicated in flags. Return 0 on failure to allocate memory.
|
||||
*/
|
||||
extern JSAtom *
|
||||
js_AtomizeString(JSContext *cx, JSString *str, uintN flags);
|
||||
|
||||
extern JS_FRIEND_API(JSAtom *)
|
||||
js_Atomize(JSContext *cx, const char *bytes, size_t length, uintN flags);
|
||||
|
||||
extern JS_FRIEND_API(JSAtom *)
|
||||
js_AtomizeChars(JSContext *cx, const jschar *chars, size_t length, uintN flags);
|
||||
|
||||
/*
|
||||
* This variant handles all value tag types.
|
||||
*/
|
||||
extern JSAtom *
|
||||
js_AtomizeValue(JSContext *cx, jsval value, uintN flags);
|
||||
|
||||
/*
|
||||
* Convert v to an atomized string.
|
||||
*/
|
||||
extern JSAtom *
|
||||
js_ValueToStringAtom(JSContext *cx, jsval v);
|
||||
|
||||
/*
|
||||
* Assign atom an index and insert it on al.
|
||||
*/
|
||||
extern JSAtomListElement *
|
||||
js_IndexAtom(JSContext *cx, JSAtom *atom, JSAtomList *al);
|
||||
|
||||
/*
|
||||
* Get the atom with index i from map.
|
||||
*/
|
||||
extern JS_FRIEND_API(JSAtom *)
|
||||
js_GetAtom(JSContext *cx, JSAtomMap *map, jsatomid i);
|
||||
|
||||
/*
|
||||
* For all unmapped atoms recorded in al, add a mapping from the atom's index
|
||||
* to its address. The GC must not run until all indexed atoms in atomLists
|
||||
* have been mapped by scripts connected to live objects (Function and Script
|
||||
* class objects have scripts as/in their private data -- the GC knows about
|
||||
* these two classes).
|
||||
*/
|
||||
extern JS_FRIEND_API(JSBool)
|
||||
js_InitAtomMap(JSContext *cx, JSAtomMap *map, JSAtomList *al);
|
||||
|
||||
/*
|
||||
* Free map->vector and clear map.
|
||||
*/
|
||||
extern JS_FRIEND_API(void)
|
||||
js_FreeAtomMap(JSContext *cx, JSAtomMap *map);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
#endif /* jsatom_h___ */
|
||||
92
mozilla/js/src/jsbit.h
Normal file
92
mozilla/js/src/jsbit.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef jsbit_h___
|
||||
#define jsbit_h___
|
||||
|
||||
#include "jstypes.h"
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
/*
|
||||
** A jsbitmap_t is a long integer that can be used for bitmaps
|
||||
*/
|
||||
typedef unsigned long jsbitmap_t;
|
||||
|
||||
#define JS_TEST_BIT(_map,_bit) \
|
||||
((_map)[(_bit)>>JS_BITS_PER_LONG_LOG2] & (1L << ((_bit) & (JS_BITS_PER_LONG-1))))
|
||||
#define JS_SET_BIT(_map,_bit) \
|
||||
((_map)[(_bit)>>JS_BITS_PER_LONG_LOG2] |= (1L << ((_bit) & (JS_BITS_PER_LONG-1))))
|
||||
#define JS_CLEAR_BIT(_map,_bit) \
|
||||
((_map)[(_bit)>>JS_BITS_PER_LONG_LOG2] &= ~(1L << ((_bit) & (JS_BITS_PER_LONG-1))))
|
||||
|
||||
/*
|
||||
** Compute the log of the least power of 2 greater than or equal to n
|
||||
*/
|
||||
EXTERN(JSIntn) JS_CeilingLog2(JSUint32 i);
|
||||
|
||||
/*
|
||||
** Compute the log of the greatest power of 2 less than or equal to n
|
||||
*/
|
||||
EXTERN(JSIntn) JS_FloorLog2(JSUint32 i);
|
||||
|
||||
/*
|
||||
** Macro version of JS_CeilingLog2: Compute the log of the least power of
|
||||
** 2 greater than or equal to _n. The result is returned in _log2.
|
||||
*/
|
||||
#define JS_CEILING_LOG2(_log2,_n) \
|
||||
JS_BEGIN_MACRO \
|
||||
JSUint32 j_ = (JSUint32)(_n); \
|
||||
(_log2) = 0; \
|
||||
if ((j_) & ((j_)-1)) \
|
||||
(_log2) += 1; \
|
||||
if ((j_) >> 16) \
|
||||
(_log2) += 16, (j_) >>= 16; \
|
||||
if ((j_) >> 8) \
|
||||
(_log2) += 8, (j_) >>= 8; \
|
||||
if ((j_) >> 4) \
|
||||
(_log2) += 4, (j_) >>= 4; \
|
||||
if ((j_) >> 2) \
|
||||
(_log2) += 2, (j_) >>= 2; \
|
||||
if ((j_) >> 1) \
|
||||
(_log2) += 1; \
|
||||
JS_END_MACRO
|
||||
|
||||
/*
|
||||
** Macro version of JS_FloorLog2: Compute the log of the greatest power of
|
||||
** 2 less than or equal to _n. The result is returned in _log2.
|
||||
**
|
||||
** This is equivalent to finding the highest set bit in the word.
|
||||
*/
|
||||
#define JS_FLOOR_LOG2(_log2,_n) \
|
||||
JS_BEGIN_MACRO \
|
||||
JSUint32 j_ = (JSUint32)(_n); \
|
||||
(_log2) = 0; \
|
||||
if ((j_) >> 16) \
|
||||
(_log2) += 16, (j_) >>= 16; \
|
||||
if ((j_) >> 8) \
|
||||
(_log2) += 8, (j_) >>= 8; \
|
||||
if ((j_) >> 4) \
|
||||
(_log2) += 4, (j_) >>= 4; \
|
||||
if ((j_) >> 2) \
|
||||
(_log2) += 2, (j_) >>= 2; \
|
||||
if ((j_) >> 1) \
|
||||
(_log2) += 1; \
|
||||
JS_END_MACRO
|
||||
|
||||
JS_END_EXTERN_C
|
||||
#endif /* jsbit_h___ */
|
||||
211
mozilla/js/src/jsbool.c
Normal file
211
mozilla/js/src/jsbool.c
Normal file
@@ -0,0 +1,211 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* JS boolean implementation.
|
||||
*/
|
||||
#include "jsstddef.h"
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsapi.h"
|
||||
#include "jsatom.h"
|
||||
#include "jsbool.h"
|
||||
#include "jscntxt.h"
|
||||
#include "jsconfig.h"
|
||||
#include "jsinterp.h"
|
||||
#include "jslock.h"
|
||||
#include "jsnum.h"
|
||||
#include "jsobj.h"
|
||||
#include "jsstr.h"
|
||||
|
||||
static JSClass boolean_class = {
|
||||
"Boolean",
|
||||
JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||
};
|
||||
|
||||
#if JS_HAS_TOSOURCE
|
||||
#include "jsprf.h"
|
||||
|
||||
static JSBool
|
||||
bool_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
jsval *rval)
|
||||
{
|
||||
jsval v;
|
||||
char buf[32];
|
||||
JSString *str;
|
||||
|
||||
if (!JS_InstanceOf(cx, obj, &boolean_class, argv))
|
||||
return JS_FALSE;
|
||||
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
|
||||
if (!JSVAL_IS_BOOLEAN(v))
|
||||
return js_obj_toSource(cx, obj, argc, argv, rval);
|
||||
JS_snprintf(buf, sizeof buf, "(new %s(%s))",
|
||||
boolean_class.name,
|
||||
js_boolean_str[JSVAL_TO_BOOLEAN(v) ? 1 : 0]);
|
||||
str = JS_NewStringCopyZ(cx, buf);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
*rval = STRING_TO_JSVAL(str);
|
||||
return JS_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static JSBool
|
||||
bool_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
jsval *rval)
|
||||
{
|
||||
jsval v;
|
||||
JSAtom *atom;
|
||||
JSString *str;
|
||||
|
||||
if (!JS_InstanceOf(cx, obj, &boolean_class, argv))
|
||||
return JS_FALSE;
|
||||
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
|
||||
if (!JSVAL_IS_BOOLEAN(v))
|
||||
return js_obj_toString(cx, obj, argc, argv, rval);
|
||||
atom = cx->runtime->atomState.booleanAtoms[JSVAL_TO_BOOLEAN(v) ? 1 : 0];
|
||||
str = ATOM_TO_STRING(atom);
|
||||
if (!str)
|
||||
return JS_FALSE;
|
||||
*rval = STRING_TO_JSVAL(str);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
bool_valueOf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
if (!JS_InstanceOf(cx, obj, &boolean_class, argv))
|
||||
return JS_FALSE;
|
||||
*rval = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSFunctionSpec boolean_methods[] = {
|
||||
#if JS_HAS_TOSOURCE
|
||||
{js_toSource_str, bool_toSource, 0},
|
||||
#endif
|
||||
{js_toString_str, bool_toString, 0},
|
||||
{js_valueOf_str, bool_valueOf, 0},
|
||||
{0}
|
||||
};
|
||||
|
||||
#ifdef XP_MAC
|
||||
#undef Boolean
|
||||
#define Boolean js_Boolean
|
||||
#endif
|
||||
|
||||
static JSBool
|
||||
Boolean(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
JSBool b;
|
||||
jsval bval;
|
||||
|
||||
if (argc != 0) {
|
||||
if (!js_ValueToBoolean(cx, argv[0], &b))
|
||||
return JS_FALSE;
|
||||
bval = BOOLEAN_TO_JSVAL(b);
|
||||
} else {
|
||||
bval = JSVAL_FALSE;
|
||||
}
|
||||
if (!cx->fp->constructing) {
|
||||
*rval = bval;
|
||||
return JS_TRUE;
|
||||
}
|
||||
OBJ_SET_SLOT(cx, obj, JSSLOT_PRIVATE, bval);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSObject *
|
||||
js_InitBooleanClass(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JSObject *proto;
|
||||
|
||||
proto = JS_InitClass(cx, obj, NULL, &boolean_class, Boolean, 1,
|
||||
NULL, boolean_methods, NULL, NULL);
|
||||
if (!proto)
|
||||
return NULL;
|
||||
OBJ_SET_SLOT(cx, proto, JSSLOT_PRIVATE, JSVAL_FALSE);
|
||||
return proto;
|
||||
}
|
||||
|
||||
JSObject *
|
||||
js_BooleanToObject(JSContext *cx, JSBool b)
|
||||
{
|
||||
JSObject *obj;
|
||||
|
||||
obj = js_NewObject(cx, &boolean_class, NULL, NULL);
|
||||
if (!obj)
|
||||
return NULL;
|
||||
OBJ_SET_SLOT(cx, obj, JSSLOT_PRIVATE, BOOLEAN_TO_JSVAL(b));
|
||||
return obj;
|
||||
}
|
||||
|
||||
JSString *
|
||||
js_BooleanToString(JSContext *cx, JSBool b)
|
||||
{
|
||||
return ATOM_TO_STRING(cx->runtime->atomState.booleanAtoms[b ? 1 : 0]);
|
||||
}
|
||||
|
||||
JSBool
|
||||
js_ValueToBoolean(JSContext *cx, jsval v, JSBool *bp)
|
||||
{
|
||||
JSBool b;
|
||||
jsdouble d;
|
||||
|
||||
#if defined XP_PC && defined _MSC_VER &&_MSC_VER <= 800
|
||||
/* MSVC1.5 coredumps */
|
||||
if (!bp)
|
||||
return JS_TRUE;
|
||||
#endif
|
||||
|
||||
/* XXX this should be an if-else chain, but MSVC1.5 crashes if it is. */
|
||||
if (JSVAL_IS_NULL(v) || JSVAL_IS_VOID(v)) {
|
||||
/* Must return early to avoid falling thru to JSVAL_IS_OBJECT case. */
|
||||
*bp = JS_FALSE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
if (JSVAL_IS_OBJECT(v)) {
|
||||
if (!JSVERSION_IS_ECMA(cx->version)) {
|
||||
if (!OBJ_DEFAULT_VALUE(cx, JSVAL_TO_OBJECT(v), JSTYPE_BOOLEAN, &v))
|
||||
return JS_FALSE;
|
||||
if (!JSVAL_IS_BOOLEAN(v))
|
||||
v = JSVAL_TRUE; /* non-null object is true */
|
||||
b = JSVAL_TO_BOOLEAN(v);
|
||||
} else {
|
||||
b = JS_TRUE;
|
||||
}
|
||||
}
|
||||
if (JSVAL_IS_STRING(v)) {
|
||||
b = JSVAL_TO_STRING(v)->length ? JS_TRUE : JS_FALSE;
|
||||
}
|
||||
if (JSVAL_IS_INT(v)) {
|
||||
b = JSVAL_TO_INT(v) ? JS_TRUE : JS_FALSE;
|
||||
}
|
||||
if (JSVAL_IS_DOUBLE(v)) {
|
||||
d = *JSVAL_TO_DOUBLE(v);
|
||||
b = (!JSDOUBLE_IS_NaN(d) && d != 0) ? JS_TRUE : JS_FALSE;
|
||||
}
|
||||
if (JSVAL_IS_BOOLEAN(v)) {
|
||||
b = JSVAL_TO_BOOLEAN(v);
|
||||
}
|
||||
*bp = b;
|
||||
return JS_TRUE;
|
||||
}
|
||||
41
mozilla/js/src/jsbool.h
Normal file
41
mozilla/js/src/jsbool.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef jsbool_h___
|
||||
#define jsbool_h___
|
||||
/*
|
||||
* JS boolean interface.
|
||||
*/
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
extern JSObject *
|
||||
js_InitBooleanClass(JSContext *cx, JSObject *obj);
|
||||
|
||||
extern JSObject *
|
||||
js_BooleanToObject(JSContext *cx, JSBool b);
|
||||
|
||||
extern JSString *
|
||||
js_BooleanToString(JSContext *cx, JSBool b);
|
||||
|
||||
extern JSBool
|
||||
js_ValueToBoolean(JSContext *cx, jsval v, JSBool *bp);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
#endif /* jsbool_h___ */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user