Compare commits
2 Commits
Bugzilla_P
...
Accessible
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
408f483d7d | ||
|
|
1d82631a5a |
32
mozilla/accessible/Makefile.in
Normal file
32
mozilla/accessible/Makefile.in
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
50
mozilla/accessible/build/Makefile.in
Normal file
50
mozilla/accessible/build/Makefile.in
Normal file
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
47
mozilla/accessible/build/makefile.win
Normal file
47
mozilla/accessible/build/makefile.win
Normal file
@@ -0,0 +1,47 @@
|
||||
#!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
|
||||
|
||||
60
mozilla/accessible/build/nsAccessibilityFactory.cpp
Normal file
60
mozilla/accessible/build/nsAccessibilityFactory.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -*- 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);
|
||||
|
||||
BIN
mozilla/accessible/macbuild/accessible.mcp
Normal file
BIN
mozilla/accessible/macbuild/accessible.mcp
Normal file
Binary file not shown.
BIN
mozilla/accessible/macbuild/accessibleIDL.mcp
Normal file
BIN
mozilla/accessible/macbuild/accessibleIDL.mcp
Normal file
Binary file not shown.
26
mozilla/accessible/makefile.win
Normal file
26
mozilla/accessible/makefile.win
Normal file
@@ -0,0 +1,26 @@
|
||||
#!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>
|
||||
3
mozilla/accessible/public/MANIFEST
Normal file
3
mozilla/accessible/public/MANIFEST
Normal file
@@ -0,0 +1,3 @@
|
||||
nsIAccessibilityService.idl
|
||||
nsIAccessible.idl
|
||||
nsIMutableAccessible.idl
|
||||
41
mozilla/accessible/public/Makefile.in
Normal file
41
mozilla/accessible/public/Makefile.in
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
34
mozilla/accessible/public/makefile.win
Normal file
34
mozilla/accessible/public/makefile.win
Normal file
@@ -0,0 +1,34 @@
|
||||
#!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>
|
||||
53
mozilla/accessible/public/nsIAccessibilityService.idl
Normal file
53
mozilla/accessible/public/nsIAccessibilityService.idl
Normal file
@@ -0,0 +1,53 @@
|
||||
/* -*- 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);
|
||||
%}
|
||||
205
mozilla/accessible/public/nsIAccessible.idl
Normal file
205
mozilla/accessible/public/nsIAccessible.idl
Normal file
@@ -0,0 +1,205 @@
|
||||
/* -*- 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
|
||||
|
||||
*/
|
||||
|
||||
};
|
||||
34
mozilla/accessible/public/nsIAccessibleEventListener.idl
Normal file
34
mozilla/accessible/public/nsIAccessibleEventListener.idl
Normal file
@@ -0,0 +1,34 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
32
mozilla/accessible/public/nsIAccessibleEventReceiver.idl
Normal file
32
mozilla/accessible/public/nsIAccessibleEventReceiver.idl
Normal file
@@ -0,0 +1,32 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
36
mozilla/accessible/public/nsIMutableAccessible.idl
Normal file
36
mozilla/accessible/public/nsIMutableAccessible.idl
Normal file
@@ -0,0 +1,36 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
49
mozilla/accessible/src/Makefile.in
Normal file
49
mozilla/accessible/src/Makefile.in
Normal file
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
252
mozilla/accessible/src/base/nsAccessibilityService.cpp
Normal file
252
mozilla/accessible/src/base/nsAccessibilityService.cpp
Normal file
@@ -0,0 +1,252 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
53
mozilla/accessible/src/base/nsAccessibilityService.h
Normal file
53
mozilla/accessible/src/base/nsAccessibilityService.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* -*- 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__ */
|
||||
995
mozilla/accessible/src/base/nsAccessible.cpp
Normal file
995
mozilla/accessible/src/base/nsAccessible.cpp
Normal file
@@ -0,0 +1,995 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
79
mozilla/accessible/src/base/nsAccessible.h
Normal file
79
mozilla/accessible/src/base/nsAccessible.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- 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
|
||||
335
mozilla/accessible/src/base/nsGenericAccessible.cpp
Normal file
335
mozilla/accessible/src/base/nsGenericAccessible.cpp
Normal file
@@ -0,0 +1,335 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
84
mozilla/accessible/src/base/nsGenericAccessible.h
Normal file
84
mozilla/accessible/src/base/nsGenericAccessible.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/* -*- 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
|
||||
199
mozilla/accessible/src/base/nsRootAccessible.cpp
Normal file
199
mozilla/accessible/src/base/nsRootAccessible.cpp
Normal file
@@ -0,0 +1,199 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
70
mozilla/accessible/src/base/nsRootAccessible.h
Normal file
70
mozilla/accessible/src/base/nsRootAccessible.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* -*- 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
|
||||
717
mozilla/accessible/src/base/nsSelectAccessible.cpp
Normal file
717
mozilla/accessible/src/base/nsSelectAccessible.cpp
Normal file
@@ -0,0 +1,717 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
51
mozilla/accessible/src/base/nsSelectAccessible.h
Normal file
51
mozilla/accessible/src/base/nsSelectAccessible.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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
|
||||
175
mozilla/accessible/src/html/nsHTMLFormControlAccessible.cpp
Normal file
175
mozilla/accessible/src/html/nsHTMLFormControlAccessible.cpp
Normal file
@@ -0,0 +1,175 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
77
mozilla/accessible/src/html/nsHTMLFormControlAccessible.h
Normal file
77
mozilla/accessible/src/html/nsHTMLFormControlAccessible.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- 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
|
||||
51
mozilla/accessible/src/html/nsHTMLTextAccessible.cpp
Normal file
51
mozilla/accessible/src/html/nsHTMLTextAccessible.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
43
mozilla/accessible/src/html/nsHTMLTextAccessible.h
Normal file
43
mozilla/accessible/src/html/nsHTMLTextAccessible.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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
|
||||
53
mozilla/accessible/src/makefile.win
Normal file
53
mozilla/accessible/src/makefile.win
Normal file
@@ -0,0 +1,53 @@
|
||||
#!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
|
||||
|
||||
|
||||
|
||||
|
||||
252
mozilla/accessible/src/nsAccessibilityService.cpp
Normal file
252
mozilla/accessible/src/nsAccessibilityService.cpp
Normal file
@@ -0,0 +1,252 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
53
mozilla/accessible/src/nsAccessibilityService.h
Normal file
53
mozilla/accessible/src/nsAccessibilityService.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* -*- 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__ */
|
||||
995
mozilla/accessible/src/nsAccessible.cpp
Normal file
995
mozilla/accessible/src/nsAccessible.cpp
Normal file
@@ -0,0 +1,995 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
79
mozilla/accessible/src/nsAccessible.h
Normal file
79
mozilla/accessible/src/nsAccessible.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- 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
|
||||
335
mozilla/accessible/src/nsGenericAccessible.cpp
Normal file
335
mozilla/accessible/src/nsGenericAccessible.cpp
Normal file
@@ -0,0 +1,335 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
84
mozilla/accessible/src/nsGenericAccessible.h
Normal file
84
mozilla/accessible/src/nsGenericAccessible.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/* -*- 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
|
||||
175
mozilla/accessible/src/nsHTMLFormControlAccessible.cpp
Normal file
175
mozilla/accessible/src/nsHTMLFormControlAccessible.cpp
Normal file
@@ -0,0 +1,175 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
77
mozilla/accessible/src/nsHTMLFormControlAccessible.h
Normal file
77
mozilla/accessible/src/nsHTMLFormControlAccessible.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- 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
|
||||
51
mozilla/accessible/src/nsHTMLTextAccessible.cpp
Normal file
51
mozilla/accessible/src/nsHTMLTextAccessible.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
43
mozilla/accessible/src/nsHTMLTextAccessible.h
Normal file
43
mozilla/accessible/src/nsHTMLTextAccessible.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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
|
||||
263
mozilla/accessible/src/nsMutableAccessible.cpp
Normal file
263
mozilla/accessible/src/nsMutableAccessible.cpp
Normal file
@@ -0,0 +1,263 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
52
mozilla/accessible/src/nsMutableAccessible.h
Normal file
52
mozilla/accessible/src/nsMutableAccessible.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* -*- 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
|
||||
|
||||
199
mozilla/accessible/src/nsRootAccessible.cpp
Normal file
199
mozilla/accessible/src/nsRootAccessible.cpp
Normal file
@@ -0,0 +1,199 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
70
mozilla/accessible/src/nsRootAccessible.h
Normal file
70
mozilla/accessible/src/nsRootAccessible.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* -*- 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
|
||||
717
mozilla/accessible/src/nsSelectAccessible.cpp
Normal file
717
mozilla/accessible/src/nsSelectAccessible.cpp
Normal file
@@ -0,0 +1,717 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
51
mozilla/accessible/src/nsSelectAccessible.h
Normal file
51
mozilla/accessible/src/nsSelectAccessible.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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
|
||||
33
mozilla/content/base/public/nsCopySupport.h
Normal file
33
mozilla/content/base/public/nsCopySupport.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/* -*- 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);
|
||||
};
|
||||
227
mozilla/content/base/src/nsCopySupport.cpp
Normal file
227
mozilla/content/base/src/nsCopySupport.cpp
Normal file
@@ -0,0 +1,227 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
90
mozilla/content/html/content/public/nsIHTMLContent.h
Normal file
90
mozilla/content/html/content/public/nsIHTMLContent.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/* -*- 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___ */
|
||||
46
mozilla/layout/Makefile.in
Normal file
46
mozilla/layout/Makefile.in
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# 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 = base html xul
|
||||
|
||||
ifdef MOZ_MATHML
|
||||
DIRS += mathml
|
||||
endif
|
||||
|
||||
ifdef MOZ_SVG
|
||||
DIRS += svg
|
||||
endif
|
||||
|
||||
DIRS += build
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += html/tests
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
32
mozilla/layout/base/Makefile.in
Normal file
32
mozilla/layout/base/Makefile.in
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
30
mozilla/layout/base/makefile.win
Normal file
30
mozilla/layout/base/makefile.win
Normal file
@@ -0,0 +1,30 @@
|
||||
#!nmake
|
||||
#
|
||||
# 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 \
|
||||
!if !defined(DISABLE_TESTS)
|
||||
tests \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
41
mozilla/layout/base/public/MANIFEST
Normal file
41
mozilla/layout/base/public/MANIFEST
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:layout directory
|
||||
#
|
||||
nsFrameList.h
|
||||
nsFrameTraversal.h
|
||||
nsHTMLReflowState.h
|
||||
nsIAutoCopy.h
|
||||
nsICaret.h
|
||||
nsIFocusTracker.h
|
||||
nsIFrame.h
|
||||
nsIFrameDebug.h
|
||||
nsIFrameImageLoader.h
|
||||
nsIFrameManager.h
|
||||
nsIFrameSelection.h
|
||||
nsIFrameUtil.h
|
||||
nsIIndependentSelection.h
|
||||
nsILayoutDebugger.h
|
||||
nsILayoutHistoryState.h
|
||||
nsIMutableStyleContext.h
|
||||
nsIPageSequenceFrame.h
|
||||
nsIPresContext.h
|
||||
nsIPresShell.h
|
||||
nsIPresState.h
|
||||
nsIPrintContext.h
|
||||
nsIReflowCallback.h
|
||||
nsIReflowCommand.h
|
||||
nsIScrollableFrame.h
|
||||
nsIScrollableViewProvider.h
|
||||
nsISpaceManager.h
|
||||
nsIStatefulFrame.h
|
||||
nsIStyleContext.h
|
||||
nsIStyleSet.h
|
||||
nslayout.h
|
||||
nsStyleChangeList.h
|
||||
nsStyleConsts.h
|
||||
nsIStyleFrameConstruction.h
|
||||
nsStyleStruct.h
|
||||
nsIFrameTraversal.h
|
||||
nsIObjectFrame.h
|
||||
nsIImageFrame.h
|
||||
nsITextFrame.h
|
||||
6
mozilla/layout/base/public/MANIFEST_IDL
Normal file
6
mozilla/layout/base/public/MANIFEST_IDL
Normal file
@@ -0,0 +1,6 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:idl directory
|
||||
#
|
||||
|
||||
nsIChromeEventHandler.idl
|
||||
nsIPrintListener.idl
|
||||
87
mozilla/layout/base/public/Makefile.in
Normal file
87
mozilla/layout/base/public/Makefile.in
Normal file
@@ -0,0 +1,87 @@
|
||||
#
|
||||
# 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 = layout
|
||||
XPIDL_MODULE = layout_base
|
||||
|
||||
EXPORTS = \
|
||||
nslayout.h \
|
||||
nsHTMLReflowState.h \
|
||||
nsIAutoCopy.h \
|
||||
nsICaret.h \
|
||||
nsIFocusTracker.h \
|
||||
nsIFrame.h \
|
||||
nsIImageFrame.h \
|
||||
nsIObjectFrame.h \
|
||||
nsIFrameTraversal.h \
|
||||
nsIFrameDebug.h \
|
||||
nsIFrameImageLoader.h \
|
||||
nsIFrameManager.h \
|
||||
nsIIndependentSelection.h \
|
||||
nsILayoutDebugger.h \
|
||||
nsIFrameUtil.h \
|
||||
nsIPageSequenceFrame.h \
|
||||
nsIPresContext.h \
|
||||
nsIPresShell.h \
|
||||
nsIPresState.h \
|
||||
nsIPrintContext.h \
|
||||
nsIReflowCallback.h \
|
||||
nsIReflowCommand.h \
|
||||
nsIFrameSelection.h \
|
||||
nsISpaceManager.h \
|
||||
nsIStyleContext.h \
|
||||
nsIMutableStyleContext.h \
|
||||
nsIStyleFrameConstruction.h \
|
||||
nsIStyleSet.h \
|
||||
nsFrameList.h \
|
||||
nsFrameTraversal.h \
|
||||
nsStyleChangeList.h \
|
||||
nsStyleConsts.h \
|
||||
nsStyleStruct.h \
|
||||
nsILayoutHistoryState.h \
|
||||
nsIStatefulFrame.h \
|
||||
nsIScrollableFrame.h \
|
||||
nsIScrollableViewProvider.h \
|
||||
$(NULL)
|
||||
|
||||
ifdef IBMBIDI
|
||||
EXPORTS += \
|
||||
nsBidiPresUtils.h \
|
||||
nsITextFrame.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIChromeEventHandler.idl \
|
||||
nsIPrintListener.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
77
mozilla/layout/base/public/makefile.win
Normal file
77
mozilla/layout/base/public/makefile.win
Normal file
@@ -0,0 +1,77 @@
|
||||
#!nmake
|
||||
#
|
||||
# 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=..\..\..
|
||||
|
||||
EXPORTS = \
|
||||
nslayout.h \
|
||||
nsHTMLReflowState.h \
|
||||
nsIAutoCopy.h \
|
||||
nsICaret.h \
|
||||
nsIFocusTracker.h \
|
||||
nsIFrame.h \
|
||||
nsIObjectFrame.h \
|
||||
nsIImageFrame.h \
|
||||
nsIFrameTraversal.h \
|
||||
nsIFrameDebug.h \
|
||||
nsIFrameImageLoader.h \
|
||||
nsIFrameManager.h \
|
||||
nsIIndependentSelection.h \
|
||||
nsILayoutDebugger.h \
|
||||
nsIFrameUtil.h \
|
||||
nsIPageSequenceFrame.h \
|
||||
nsIPresContext.h \
|
||||
nsIPresShell.h \
|
||||
nsIPresState.h \
|
||||
nsIReflowCallback.h \
|
||||
nsIReflowCommand.h \
|
||||
nsIFrameSelection.h \
|
||||
nsISpaceManager.h \
|
||||
nsIStyleContext.h \
|
||||
nsIMutableStyleContext.h \
|
||||
nsIStyleFrameConstruction.h \
|
||||
nsIStyleSet.h \
|
||||
nsFrameList.h \
|
||||
nsFrameTraversal.h \
|
||||
nsStyleChangeList.h \
|
||||
nsStyleConsts.h \
|
||||
nsStyleStruct.h \
|
||||
nsILayoutHistoryState.h \
|
||||
nsIStatefulFrame.h \
|
||||
nsIScrollableFrame.h \
|
||||
nsIScrollableViewProvider.h \
|
||||
nsIPrintContext.h \
|
||||
!ifdef IBMBIDI
|
||||
nsBidiPresUtils.h \
|
||||
nsITextFrame.h \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
MODULE=layout_base
|
||||
|
||||
XPIDLSRCS= \
|
||||
.\nsIChromeEventHandler.idl \
|
||||
.\nsIPrintListener.idl \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
155
mozilla/layout/base/public/nsBidiPresUtils.h
Normal file
155
mozilla/layout/base/public/nsBidiPresUtils.h
Normal file
@@ -0,0 +1,155 @@
|
||||
/* -*- 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* IBM Corporation. Portions created by IBM are
|
||||
* Copyright (C) 2000 IBM Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef IBMBIDI
|
||||
|
||||
#ifndef nsBidiPresUtils_h___
|
||||
#define nsBidiPresUtils_h___
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIBidi.h"
|
||||
|
||||
class nsIUBidiUtils;
|
||||
|
||||
class nsBidiPresUtils {
|
||||
public:
|
||||
nsBidiPresUtils();
|
||||
~nsBidiPresUtils();
|
||||
PRBool IsSuccessful(void) const;
|
||||
|
||||
/**
|
||||
* Make Bidi engine calculate embedding levels of the frames.
|
||||
*
|
||||
* @lina 06/18/2000
|
||||
*/
|
||||
nsresult Resolve(nsIPresContext* aPresContext,
|
||||
nsIFrame* aBlockFrame,
|
||||
nsIFrame* aFirstChild,
|
||||
PRBool& aForceReflow);
|
||||
|
||||
/**
|
||||
* Reorder this line using Bidi engine.
|
||||
* Update frame array, following the new visual sequence.
|
||||
*
|
||||
* @lina 05/02/2000
|
||||
*/
|
||||
void ReorderFrames(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext* aRendContext,
|
||||
nsIFrame* aFirstChild,
|
||||
nsIFrame* aNextInFlow,
|
||||
PRInt32 aChildCount);
|
||||
|
||||
/**
|
||||
* Format Unicode text, taking into account bidi capabilities
|
||||
* of the platform. The formatting includes: reordering, Arabic shaping,
|
||||
* symmetric and numeric swapping, removing control characters.
|
||||
*
|
||||
* @lina 06/18/2000
|
||||
*/
|
||||
nsresult FormatUnicodeText(nsIPresContext* aPresContext,
|
||||
PRUnichar* aText,
|
||||
PRInt32& aTextLength,
|
||||
nsCharType aCharType,
|
||||
PRBool aIsOddLevel,
|
||||
PRBool aIsBidiSystem);
|
||||
|
||||
/**
|
||||
* Return our nsIBidi object (bidi reordering engine)
|
||||
*/
|
||||
nsresult GetBidiEngine(nsIBidi** aBidiEngine);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Create a string containing entire text content of this block.
|
||||
*
|
||||
* @lina 05/02/2000
|
||||
*/
|
||||
void CreateBlockBuffer(nsIPresContext* aPresContext);
|
||||
|
||||
/**
|
||||
* Set up an array of the frames after splitting frames so that each frame has
|
||||
* consistent directionality. At this point the frames are still in logical
|
||||
* order
|
||||
*/
|
||||
nsresult InitLogicalArray(nsIPresContext* aPresContext,
|
||||
nsIFrame* aCurrentFrame,
|
||||
nsIFrame* aNextInFlow,
|
||||
PRBool aAddMarkers = PR_FALSE);
|
||||
/**
|
||||
* Reorder the frame array from logical to visual order
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aBidiEnabled TRUE on return if the visual order is different from
|
||||
* the logical order
|
||||
*/
|
||||
nsresult Reorder(nsIPresContext* aPresContext,
|
||||
PRBool& aBidiEnabled);
|
||||
|
||||
/**
|
||||
* Adjust frame positions following their visual order
|
||||
*
|
||||
* @param <code>nsIPresContext*</code>, the first kid
|
||||
*
|
||||
* @lina 04/11/2000
|
||||
*/
|
||||
void RepositionInlineFrames(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext* aRendContext,
|
||||
nsIFrame* aFirstChild,
|
||||
PRInt32 aChildCount) const;
|
||||
|
||||
void RepositionContainerFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aContainer,
|
||||
PRInt32& aMinX,
|
||||
PRInt32& aMaxX) const;
|
||||
PRBool EnsureBidiContinuation(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aFrame,
|
||||
nsIFrame** aNewFrame,
|
||||
PRInt32& aFrameIndex);
|
||||
PRBool RemoveBidiContinuation(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIFrame* aNextFrame,
|
||||
nsIContent* aContent,
|
||||
PRInt32& aFrameIndex,
|
||||
PRInt32& aOffset) const;
|
||||
void CalculateCharType(PRInt32 aLimit,
|
||||
PRInt32& aOffset,
|
||||
PRUint8& aCharType,
|
||||
PRUint8& aPrevCharType) const;
|
||||
|
||||
nsAutoString mBuffer;
|
||||
nsVoidArray mLogicalFrames;
|
||||
nsVoidArray mVisualFrames;
|
||||
PRInt32 mArraySize;
|
||||
PRInt32* mIndexMap;
|
||||
PRUint8* mLevels;
|
||||
nsresult mSuccess;
|
||||
|
||||
nsIBidi* mBidiEngine;
|
||||
nsIUBidiUtils* mUnicodeUtils;
|
||||
};
|
||||
|
||||
#endif /* nsBidiPresUtils_h___ */
|
||||
|
||||
#endif // IBMBIDI
|
||||
147
mozilla/layout/base/public/nsFrameList.h
Normal file
147
mozilla/layout/base/public/nsFrameList.h
Normal file
@@ -0,0 +1,147 @@
|
||||
/* -*- 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 Communicator client 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 nsFrameList_h___
|
||||
#define nsFrameList_h___
|
||||
|
||||
#include "nsIFrame.h"
|
||||
|
||||
/**
|
||||
* A class for managing a singly linked list of frames. Frames are
|
||||
* linked together through their next-sibling pointer.
|
||||
*/
|
||||
class nsFrameList {
|
||||
public:
|
||||
nsFrameList() {
|
||||
mFirstChild = nsnull;
|
||||
}
|
||||
|
||||
nsFrameList(nsIFrame* aHead) {
|
||||
mFirstChild = aHead;
|
||||
}
|
||||
|
||||
~nsFrameList() {
|
||||
}
|
||||
|
||||
void DestroyFrames(nsIPresContext* aPresContext);
|
||||
|
||||
void SetFrames(nsIFrame* aFrameList) {
|
||||
mFirstChild = aFrameList;
|
||||
}
|
||||
|
||||
void AppendFrames(nsIFrame* aParent, nsIFrame* aFrameList);
|
||||
|
||||
void AppendFrames(nsIFrame* aParent, nsFrameList& aFrameList) {
|
||||
AppendFrames(aParent, aFrameList.mFirstChild);
|
||||
aFrameList.mFirstChild = nsnull;
|
||||
}
|
||||
|
||||
void AppendFrame(nsIFrame* aParent, nsIFrame* aFrame);
|
||||
|
||||
// Take aFrame out of the frame list. This also disconnects aFrame
|
||||
// from the sibling list. This will return PR_FALSE if aFrame is
|
||||
// nsnull or if aFrame is not in the list.
|
||||
PRBool RemoveFrame(nsIFrame* aFrame);
|
||||
|
||||
// Remove the first child from the list. The caller is assumed to be
|
||||
// holding a reference to the first child. This call is equivalent
|
||||
// in behavior to calling RemoveFrame(FirstChild()).
|
||||
PRBool RemoveFirstChild();
|
||||
|
||||
// Take aFrame out of the frame list and then destroy it. This also
|
||||
// disconnects aFrame from the sibling list. This will return
|
||||
// PR_FALSE if aFrame is nsnull or if aFrame is not in the list.
|
||||
PRBool DestroyFrame(nsIPresContext* aPresContext, nsIFrame* aFrame);
|
||||
|
||||
void InsertFrame(nsIFrame* aParent,
|
||||
nsIFrame* aPrevSibling,
|
||||
nsIFrame* aNewFrame);
|
||||
|
||||
void InsertFrames(nsIFrame* aParent,
|
||||
nsIFrame* aPrevSibling,
|
||||
nsIFrame* aFrameList);
|
||||
|
||||
void InsertFrames(nsIFrame* aParent, nsIFrame* aPrevSibling,
|
||||
nsFrameList& aFrameList) {
|
||||
InsertFrames(aParent, aPrevSibling, aFrameList.FirstChild());
|
||||
aFrameList.mFirstChild = nsnull;
|
||||
}
|
||||
|
||||
PRBool ReplaceFrame(nsIFrame* aParent,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame);
|
||||
|
||||
PRBool ReplaceAndDestroyFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame);
|
||||
|
||||
PRBool Split(nsIFrame* aAfterFrame, nsIFrame** aNextFrameResult);
|
||||
|
||||
nsIFrame* PullFrame(nsIFrame* aParent,
|
||||
nsIFrame* aLastChild,
|
||||
nsFrameList& aFromList);
|
||||
|
||||
nsIFrame* FirstChild() const {
|
||||
return mFirstChild;
|
||||
}
|
||||
|
||||
nsIFrame* LastChild() const;
|
||||
|
||||
nsIFrame* FrameAt(PRInt32 aIndex) const;
|
||||
|
||||
PRBool IsEmpty() const {
|
||||
return nsnull == mFirstChild;
|
||||
}
|
||||
|
||||
PRBool NotEmpty() const {
|
||||
return nsnull != mFirstChild;
|
||||
}
|
||||
|
||||
PRBool ContainsFrame(const nsIFrame* aFrame) const;
|
||||
|
||||
PRInt32 GetLength() const;
|
||||
|
||||
nsIFrame* GetPrevSiblingFor(nsIFrame* aFrame) const;
|
||||
|
||||
#ifdef IBMBIDI
|
||||
/**
|
||||
* Return the frame before this frame in visual order (after Bidi reordering)
|
||||
*/
|
||||
nsIFrame* GetPrevVisualFor(nsIFrame* aFrame) const;
|
||||
|
||||
/**
|
||||
* Return the frame after this frame in visual order (after Bidi reordering)
|
||||
*/
|
||||
nsIFrame* GetNextVisualFor(nsIFrame* aFrame) const;
|
||||
#endif // IBMBIDI
|
||||
|
||||
void VerifyParent(nsIFrame* aParent) const;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
void List(nsIPresContext* aPresContext, FILE* out) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsIFrame* mFirstChild;
|
||||
};
|
||||
|
||||
#endif /* nsFrameList_h___ */
|
||||
50
mozilla/layout/base/public/nsFrameTraversal.h
Normal file
50
mozilla/layout/base/public/nsFrameTraversal.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- 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 NSFRAMETRAVERSAL_H
|
||||
#define NSFRAMETRAVERSAL_H
|
||||
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFrameTraversal.h"
|
||||
|
||||
nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
|
||||
nsTraversalType aType,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame *aStart);
|
||||
|
||||
nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
|
||||
|
||||
class nsFrameTraversal : public nsIFrameTraversal
|
||||
{
|
||||
public:
|
||||
nsFrameTraversal();
|
||||
virtual ~nsFrameTraversal();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
|
||||
PRUint32 aType,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame *aStart);
|
||||
};
|
||||
|
||||
#endif //NSFRAMETRAVERSAL_H
|
||||
411
mozilla/layout/base/public/nsHTMLReflowState.h
Normal file
411
mozilla/layout/base/public/nsHTMLReflowState.h
Normal file
@@ -0,0 +1,411 @@
|
||||
/* -*- 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 nsHTMLReflowState_h___
|
||||
#define nsHTMLReflowState_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsIReflowCommand;
|
||||
class nsIRenderingContext;
|
||||
class nsISpaceManager;
|
||||
class nsLineLayout;
|
||||
|
||||
struct nsStyleDisplay;
|
||||
struct nsStylePosition;
|
||||
struct nsStyleBorder;
|
||||
struct nsStyleMargin;
|
||||
struct nsStylePadding;
|
||||
struct nsStyleText;
|
||||
struct nsHypotheticalBox;
|
||||
|
||||
/**
|
||||
* Constant used to indicate an unconstrained size.
|
||||
*
|
||||
* @see #Reflow()
|
||||
*/
|
||||
#define NS_UNCONSTRAINEDSIZE NS_MAXSIZE
|
||||
|
||||
/**
|
||||
* The reason the frame is being reflowed.
|
||||
*
|
||||
* XXX Should probably be a #define so it can be extended for specialized
|
||||
* reflow interfaces...
|
||||
*
|
||||
* @see nsHTMLReflowState
|
||||
*/
|
||||
enum nsReflowReason {
|
||||
eReflowReason_Initial = 0, // initial reflow of a newly created frame
|
||||
eReflowReason_Incremental = 1, // an incremental change has occured. see the reflow command for details
|
||||
eReflowReason_Resize = 2, // general request to determine a desired size
|
||||
eReflowReason_StyleChange = 3, // request to reflow because of a style change. Note: you must reflow
|
||||
// all your child frames
|
||||
eReflowReason_Dirty = 4 // request to reflow because you and/or your children are dirty
|
||||
};
|
||||
|
||||
/**
|
||||
* CSS Frame type. Included as part of the reflow state.
|
||||
*/
|
||||
typedef PRUint32 nsCSSFrameType;
|
||||
|
||||
#define NS_CSS_FRAME_TYPE_UNKNOWN 0
|
||||
#define NS_CSS_FRAME_TYPE_INLINE 1
|
||||
#define NS_CSS_FRAME_TYPE_BLOCK 2 /* block-level in normal flow */
|
||||
#define NS_CSS_FRAME_TYPE_FLOATING 3
|
||||
#define NS_CSS_FRAME_TYPE_ABSOLUTE 4
|
||||
#define NS_CSS_FRAME_TYPE_INTERNAL_TABLE 5 /* row group frame, row frame, cell frame, ... */
|
||||
|
||||
/**
|
||||
* Bit-flag that indicates whether the element is replaced. Applies to inline,
|
||||
* block-level, floating, and absolutely positioned elements
|
||||
*/
|
||||
#define NS_CSS_FRAME_TYPE_REPLACED 0x8000
|
||||
|
||||
/**
|
||||
* Helper macros for telling whether items are replaced
|
||||
*/
|
||||
#define NS_FRAME_IS_REPLACED(_ft) \
|
||||
(NS_CSS_FRAME_TYPE_REPLACED == ((_ft) & NS_CSS_FRAME_TYPE_REPLACED))
|
||||
|
||||
#define NS_FRAME_REPLACED(_ft) \
|
||||
(NS_CSS_FRAME_TYPE_REPLACED | (_ft))
|
||||
|
||||
/**
|
||||
* A macro to extract the type. Masks off the 'replaced' bit-flag
|
||||
*/
|
||||
#define NS_FRAME_GET_TYPE(_ft) \
|
||||
((_ft) & ~NS_CSS_FRAME_TYPE_REPLACED)
|
||||
|
||||
#define NS_INTRINSICSIZE NS_UNCONSTRAINEDSIZE
|
||||
#define NS_SHRINKWRAPWIDTH NS_UNCONSTRAINEDSIZE
|
||||
#define NS_AUTOHEIGHT NS_UNCONSTRAINEDSIZE
|
||||
#define NS_AUTOMARGIN NS_UNCONSTRAINEDSIZE
|
||||
#define NS_AUTOOFFSET NS_UNCONSTRAINEDSIZE
|
||||
// NOTE: there are assumptions all over that these have the same value, namely NS_UNCONSTRAINEDSIZE
|
||||
// if any are changed to be a value other than NS_UNCONSTRAINEDSIZE
|
||||
// at least update AdjustComputedHeight/Width and test ad nauseum
|
||||
|
||||
/**
|
||||
* Reflow state passed to a frame during reflow.
|
||||
*
|
||||
* @see nsIFrame#Reflow()
|
||||
*/
|
||||
struct nsHTMLReflowState {
|
||||
// the reflow states are linked together. this is the pointer to the
|
||||
// parent's reflow state
|
||||
const nsHTMLReflowState* parentReflowState;
|
||||
|
||||
// the frame being reflowed
|
||||
nsIFrame* frame;
|
||||
|
||||
// the reason for the reflow
|
||||
nsReflowReason reason;
|
||||
|
||||
// the reflow command. only set for a reflow reason of eReflowReason_Incremental
|
||||
nsIReflowCommand* reflowCommand;
|
||||
|
||||
// the available space in which to reflow the frame. The space represents the
|
||||
// amount of room for the frame's border, padding, and content area (not the
|
||||
// margin area. The parent frame deals with the child frame's margins). The
|
||||
// frame size you choose should fit within the available space.
|
||||
// A value of NS_UNCONSTRAINEDSIZE for the available height means you can
|
||||
// choose whatever size you want. In galley mode the available height is always
|
||||
// NS_UNCONSTRAINEDSIZE, and only page mode involves a constrained height
|
||||
nscoord availableWidth, availableHeight;
|
||||
|
||||
// rendering context to use for measurement
|
||||
nsIRenderingContext* rendContext;
|
||||
|
||||
// is the current context at the top of a page?
|
||||
PRPackedBool isTopOfPage;
|
||||
|
||||
// The type of frame, from css's perspective. This value is
|
||||
// initialized by the Init method below.
|
||||
nsCSSFrameType mFrameType;
|
||||
|
||||
// pointer to the space manager associated with this area
|
||||
nsISpaceManager* mSpaceManager;
|
||||
|
||||
// LineLayout object (only for inline reflow; set to NULL otherwise)
|
||||
nsLineLayout* mLineLayout;
|
||||
|
||||
// The computed width specifies the frame's content area width, and it does
|
||||
// not apply to inline non-replaced elements
|
||||
//
|
||||
// For replaced inline frames, a value of NS_INTRINSICSIZE means you should
|
||||
// use your intrinsic width as the computed width
|
||||
//
|
||||
// For block-level frames, the computed width is based on the width of the
|
||||
// containing block, the margin/border/padding areas, and the min/max width.
|
||||
// A value of NS_SHRINKWRAPWIDTH means that you should choose a width based
|
||||
// on your content. The width may be as large as the specified maximum width
|
||||
// (see mComputedMaxWidth).
|
||||
nscoord mComputedWidth;
|
||||
|
||||
// The computed height specifies the frame's content height, and it does
|
||||
// not apply to inline non-replaced elements
|
||||
//
|
||||
// For replaced inline frames, a value of NS_INTRINSICSIZE means you should
|
||||
// use your intrinsic height as the computed height
|
||||
//
|
||||
// For non-replaced block-level frames in the flow and floated, a value of
|
||||
// NS_AUTOHEIGHT means you choose a height to shrink wrap around the normal
|
||||
// flow child frames. The height must be within the limit of the min/max
|
||||
// height if there is such a limit
|
||||
//
|
||||
// For replaced block-level frames, a value of NS_INTRINSICSIZE
|
||||
// means you use your intrinsic height as the computed height
|
||||
nscoord mComputedHeight;
|
||||
|
||||
// Computed margin values
|
||||
nsMargin mComputedMargin;
|
||||
|
||||
// Cached copy of the border values
|
||||
nsMargin mComputedBorderPadding;
|
||||
|
||||
// Computed padding values
|
||||
nsMargin mComputedPadding;
|
||||
|
||||
// Computed values for 'left/top/right/bottom' offsets. Only applies to
|
||||
// 'positioned' elements
|
||||
nsMargin mComputedOffsets;
|
||||
|
||||
// Computed values for 'min-width/max-width' and 'min-height/max-height'
|
||||
nscoord mComputedMinWidth, mComputedMaxWidth;
|
||||
nscoord mComputedMinHeight, mComputedMaxHeight;
|
||||
|
||||
// Compact margin available space
|
||||
nscoord mCompactMarginWidth;
|
||||
|
||||
// The following data members are relevant if nsStyleText.mTextAlign
|
||||
// == NS_STYLE_TEXT_ALIGN_CHAR
|
||||
|
||||
// distance from reference edge (as specified in nsStyleDisplay.mDirection)
|
||||
// to the align character (which will be specified in nsStyleTable)
|
||||
nscoord mAlignCharOffset;
|
||||
|
||||
// if true, the reflow honors alignCharOffset and does not
|
||||
// set it. if false, the reflow sets alignCharOffset
|
||||
PRPackedBool mUseAlignCharOffset;
|
||||
|
||||
// Cached pointers to the various style structs used during intialization
|
||||
const nsStyleDisplay* mStyleDisplay;
|
||||
const nsStylePosition* mStylePosition;
|
||||
const nsStyleBorder* mStyleBorder;
|
||||
const nsStyleMargin* mStyleMargin;
|
||||
const nsStylePadding* mStylePadding;
|
||||
const nsStyleText* mStyleText;
|
||||
|
||||
// This value keeps track of how deeply nested a given reflow state
|
||||
// is from the top of the frame tree.
|
||||
PRInt32 mReflowDepth;
|
||||
|
||||
#ifdef IBMBIDI
|
||||
nscoord mRightEdge;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
// hook for attaching debug info (e.g. tables may attach a timer during reflow)
|
||||
void* mDebugHook;
|
||||
#endif
|
||||
|
||||
// Note: The copy constructor is written by the compiler
|
||||
// automatically. You can use that and then override specific values
|
||||
// if you want, or you can call Init as desired...
|
||||
|
||||
// Initialize a <b>root</b> reflow state with a rendering context to
|
||||
// use for measuring things.
|
||||
nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsReflowReason aReason,
|
||||
nsIRenderingContext* aRenderingContext,
|
||||
const nsSize& aAvailableSpace);
|
||||
|
||||
// Initialize a <b>root</b> reflow state for an <b>incremental</b>
|
||||
// reflow.
|
||||
nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIReflowCommand& aReflowCommand,
|
||||
nsIRenderingContext* aRenderingContext,
|
||||
const nsSize& aAvailableSpace);
|
||||
|
||||
// Initialize a reflow state for a child frames reflow. Some state
|
||||
// is copied from the parent reflow state; the remaining state is
|
||||
// computed.
|
||||
nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
nsIFrame* aFrame,
|
||||
const nsSize& aAvailableSpace,
|
||||
nsReflowReason aReason);
|
||||
|
||||
// Same as the previous except that the reason is taken from the
|
||||
// parent's reflow state.
|
||||
nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
nsIFrame* aFrame,
|
||||
const nsSize& aAvailableSpace);
|
||||
|
||||
// Used when you want to override the default containing block
|
||||
// width and height. Used by absolute positioning code
|
||||
nsHTMLReflowState(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
nsIFrame* aFrame,
|
||||
const nsSize& aAvailableSpace,
|
||||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight);
|
||||
|
||||
/**
|
||||
* Get the containing block reflow state, starting from a frames
|
||||
* <B>parent</B> reflow state (the parent reflow state may or may not end
|
||||
* up being the containing block reflow state)
|
||||
*/
|
||||
static const nsHTMLReflowState*
|
||||
GetContainingBlockReflowState(const nsHTMLReflowState* aParentRS);
|
||||
|
||||
/**
|
||||
* First find the containing block's reflow state using
|
||||
* GetContainingBlockReflowState, then ask the containing block for
|
||||
* it's content width using GetContentWidth
|
||||
*/
|
||||
static nscoord
|
||||
GetContainingBlockContentWidth(const nsHTMLReflowState* aParentRS);
|
||||
|
||||
/**
|
||||
* Get the page box reflow state, starting from a frames
|
||||
* <B>parent</B> reflow state (the parent reflow state may or may not end
|
||||
* up being the containing block reflow state)
|
||||
*/
|
||||
static const nsHTMLReflowState*
|
||||
GetPageBoxReflowState(const nsHTMLReflowState* aParentRS);
|
||||
|
||||
/**
|
||||
* Compute the border plus padding for <TT>aFrame</TT>. If a
|
||||
* percentage needs to be computed it will be computed by finding
|
||||
* the containing block, use GetContainingBlockReflowState.
|
||||
* aParentReflowState is aFrame's
|
||||
* parent's reflow state. The resulting computed border plus padding
|
||||
* is returned in aResult.
|
||||
*/
|
||||
static void ComputeBorderPaddingFor(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState* aParentRS,
|
||||
nsMargin& aResult);
|
||||
|
||||
/**
|
||||
* Calculate the raw line-height property for the given frame. The return
|
||||
* value, if line-height was applied and is valid will be >= 0. Otherwise,
|
||||
* the return value will be <0 which is illegal (CSS2 spec: section 10.8.1).
|
||||
*/
|
||||
static nscoord CalcLineHeight(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext* aRenderingContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
static PRBool UseComputedHeight();
|
||||
|
||||
static nsCSSFrameType DetermineFrameType(nsIFrame* aFrame);
|
||||
|
||||
void ComputeContainingBlockRectangle(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState* aContainingBlockRS,
|
||||
nscoord& aContainingBlockWidth,
|
||||
nscoord& aContainingBlockHeight);
|
||||
|
||||
void CalculateBlockSideMargins(nscoord aAvailWidth,
|
||||
nscoord aComputedWidth);
|
||||
|
||||
|
||||
protected:
|
||||
// This method initializes various data members. It is automatically
|
||||
// called by the various constructors
|
||||
void Init(nsIPresContext* aPresContext,
|
||||
nscoord aContainingBlockWidth = -1,
|
||||
nscoord aContainingBlockHeight = -1);
|
||||
|
||||
void InitConstraints(nsIPresContext* aPresContext,
|
||||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight);
|
||||
|
||||
void CalculateHypotheticalBox(nsIPresContext* aPresContext,
|
||||
nsIFrame* aPlaceholderFrame,
|
||||
nsIFrame* aBlockFrame,
|
||||
nsMargin& aBlockContentArea,
|
||||
nsIFrame* aAbsoluteContainingBlockFrame,
|
||||
nsHypotheticalBox& aHypotheticalBox);
|
||||
|
||||
void InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState* cbrs,
|
||||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight);
|
||||
|
||||
void ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
|
||||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight);
|
||||
|
||||
void ComputeBlockBoxData(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState* cbrs,
|
||||
nsStyleUnit aWidthUnit,
|
||||
nsStyleUnit aHeightUnit,
|
||||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight);
|
||||
|
||||
void ComputeHorizontalValue(nscoord aContainingBlockWidth,
|
||||
nsStyleUnit aUnit,
|
||||
const nsStyleCoord& aCoord,
|
||||
nscoord& aResult);
|
||||
|
||||
void ComputeVerticalValue(nscoord aContainingBlockHeight,
|
||||
nsStyleUnit aUnit,
|
||||
const nsStyleCoord& aCoord,
|
||||
nscoord& aResult);
|
||||
|
||||
static nsCSSFrameType DetermineFrameType(nsIFrame* aFrame,
|
||||
const nsStylePosition* aPosition,
|
||||
const nsStyleDisplay* aDisplay);
|
||||
|
||||
// Computes margin values from the specified margin style information, and
|
||||
// fills in the mComputedMargin member
|
||||
void ComputeMargin(nscoord aContainingBlockWidth,
|
||||
const nsHTMLReflowState* aContainingBlockRS);
|
||||
|
||||
// Computes padding values from the specified padding style information, and
|
||||
// fills in the mComputedPadding member
|
||||
void ComputePadding(nscoord aContainingBlockWidth,
|
||||
const nsHTMLReflowState* aContainingBlockRS);
|
||||
|
||||
// Calculates the computed values for the 'min-Width', 'max-Width',
|
||||
// 'min-Height', and 'max-Height' properties, and stores them in the assorted
|
||||
// data members
|
||||
void ComputeMinMaxValues(nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight,
|
||||
const nsHTMLReflowState* aContainingBlockRS);
|
||||
|
||||
nscoord CalculateHorizBorderPaddingMargin(nscoord aContainingBlockWidth);
|
||||
|
||||
// Adjust Computed sizes for Min/Max Width and box-Sizing
|
||||
// - guarantees that the computed height/width will be non-negative
|
||||
// If the value goes negative (because the padding or border is greater than
|
||||
// the width/height and it is removed due to box sizing) then it is driven to 0
|
||||
void AdjustComputedHeight(void);
|
||||
void AdjustComputedWidth(void);
|
||||
};
|
||||
|
||||
#endif /* nsHTMLReflowState_h___ */
|
||||
|
||||
48
mozilla/layout/base/public/nsIAutoCopy.h
Normal file
48
mozilla/layout/base/public/nsIAutoCopy.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* -*- 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 Communicator client 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 "nsISupports.h"
|
||||
|
||||
|
||||
#ifndef nsIAutoCopyService_h__
|
||||
#define nsIAutoCopyService_h__
|
||||
|
||||
// {558B93CD-95C1-417d-A66E-F9CA66DC98A8}
|
||||
#define NS_IAUTOCOPYSERVICE_IID \
|
||||
{ 0x558b93cd, 0x95c1, 0x417d, { 0xa6, 0x6e, 0xf9, 0xca, 0x66, 0xdc, 0x98, 0xa8 } }
|
||||
|
||||
|
||||
class nsISelection;
|
||||
|
||||
class nsIAutoCopyService : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IAUTOCOPYSERVICE_IID; return iid; }
|
||||
|
||||
//This will add this service as a selection listener.
|
||||
NS_IMETHOD Listen(nsISelection *aDomSelection)=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //nsIAutoCopyService_h__
|
||||
|
||||
132
mozilla/layout/base/public/nsICaret.h
Normal file
132
mozilla/layout/base/public/nsICaret.h
Normal file
@@ -0,0 +1,132 @@
|
||||
/* -*- 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 nsICaret_h__
|
||||
#define nsICaret_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
||||
class nsIRenderingContext;
|
||||
class nsIFrame;
|
||||
class nsIView;
|
||||
struct nsRect;
|
||||
struct nsPoint;
|
||||
|
||||
// IID for the nsICaret interface
|
||||
#define NS_ICARET_IID \
|
||||
{ 0xa6cf90e1, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
class nsICaret: public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ICARET_IID; return iid; }
|
||||
|
||||
typedef enum EViewCoordinates {
|
||||
eTopLevelWindowCoordinates,
|
||||
eRenderingViewCoordinates,
|
||||
eClosestViewCoordinates,
|
||||
eIMECoordinates
|
||||
} EViewCoordinates;
|
||||
|
||||
NS_IMETHOD Init(nsIPresShell *inPresShell) = 0;
|
||||
|
||||
NS_IMETHOD SetCaretDOMSelection(nsISelection *aDOMSel) = 0;
|
||||
|
||||
/** SetCaretVisible will set the visibility of the caret
|
||||
* @param inMakeVisible PR_TRUE to show the caret, PR_FALSE to hide it
|
||||
*/
|
||||
NS_IMETHOD SetCaretVisible(PRBool inMakeVisible) = 0;
|
||||
|
||||
/** GetCaretVisible will get the visibility of the caret
|
||||
* @param inMakeVisible PR_TRUE it is shown, PR_FALSE it is hidden
|
||||
*/
|
||||
NS_IMETHOD GetCaretVisible(PRBool *outMakeVisible) = 0;
|
||||
|
||||
/** SetCaretReadOnly set the appearance of the caret
|
||||
* @param inMakeReadonly PR_TRUE to show the caret in a 'read only' state,
|
||||
* PR_FALSE to show the caret in normal, editing state
|
||||
*/
|
||||
NS_IMETHOD SetCaretReadOnly(PRBool inMakeReadonly) = 0;
|
||||
|
||||
/** GetCaretCoordinates
|
||||
* Get the position of the caret in coordinates relative to the typed specified (aRelativeToType).
|
||||
* If the selection is collapsed, this returns the caret location
|
||||
* and true in outIsCollapsed.
|
||||
* If the selection is not collapsed, this returns the location of the focus pos,
|
||||
* and false in outIsCollapsed.
|
||||
*/
|
||||
NS_IMETHOD GetCaretCoordinates(EViewCoordinates aRelativeToType, nsISelection *aDOMSel, nsRect *outCoordinates, PRBool *outIsCollapsed) = 0;
|
||||
|
||||
/** ClearFrameRefs
|
||||
* The caret stores a reference to the frame that the caret was last drawn in.
|
||||
* This is called to tell the caret that that frame is going away.
|
||||
*/
|
||||
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0;
|
||||
/** Erase Caret
|
||||
* this will erase the caret if its drawn and reset drawn status
|
||||
*/
|
||||
NS_IMETHOD EraseCaret() = 0;
|
||||
|
||||
/** Set Caret Width
|
||||
* this will set the caret width to the passed in value.
|
||||
*/
|
||||
NS_IMETHOD SetCaretWidth(nscoord aPixels) = 0;
|
||||
|
||||
};
|
||||
|
||||
extern nsresult NS_NewCaret(nsICaret** aInstancePtrResult);
|
||||
|
||||
|
||||
// handy stack-based class for temporarily disabling the caret
|
||||
|
||||
class StCaretHider
|
||||
{
|
||||
public:
|
||||
StCaretHider(nsICaret* aSelCon)
|
||||
: mWasVisible(PR_FALSE), mCaret(aSelCon)
|
||||
{
|
||||
if (mCaret)
|
||||
{
|
||||
mCaret->GetCaretVisible(&mWasVisible);
|
||||
if (mWasVisible)
|
||||
mCaret->SetCaretVisible(PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
~StCaretHider()
|
||||
{
|
||||
if (mCaret && mWasVisible)
|
||||
mCaret->SetCaretVisible(PR_TRUE);
|
||||
// nsCOMPtr releases mPresShell
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
PRBool mWasVisible;
|
||||
nsCOMPtr<nsICaret> mCaret;
|
||||
};
|
||||
|
||||
|
||||
#endif // nsICaret_h__
|
||||
|
||||
48
mozilla/layout/base/public/nsIChromeEventHandler.idl
Normal file
48
mozilla/layout/base/public/nsIChromeEventHandler.idl
Normal file
@@ -0,0 +1,48 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; 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, Inc. Portions created by Netscape are
|
||||
* Copyright (C) 1999, Mozilla. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Travis Bogard <travis@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsIPresContext.h"
|
||||
%}
|
||||
|
||||
[ptr] native nsIPresContext(nsIPresContext);
|
||||
native nsEvent(nsEvent);
|
||||
[ptr] native nsEventPtr(nsEvent);
|
||||
native nsEventStatus(nsEventStatus);
|
||||
|
||||
/**
|
||||
* The nsIChromeEventHandler
|
||||
*/
|
||||
|
||||
[scriptable, uuid(7BC08970-9E6C-11d3-AFB2-00A024FFC08C)]
|
||||
interface nsIChromeEventHandler : nsISupports
|
||||
{
|
||||
/**
|
||||
* Handle a chrome DOM event.
|
||||
*/
|
||||
[noscript] void handleChromeEvent(in nsIPresContext aPresContext,
|
||||
in nsEventPtr aEvent, out nsIDOMEvent aDOMEvent, in unsigned long aFlags,
|
||||
inout nsEventStatus aStatus);
|
||||
};
|
||||
75
mozilla/layout/base/public/nsIFocusTracker.h
Normal file
75
mozilla/layout/base/public/nsIFocusTracker.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
*/
|
||||
|
||||
#ifndef nsIFocusTracker_h___
|
||||
#define nsIFocusTracker_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
|
||||
class nsIPresContext;
|
||||
|
||||
|
||||
// IID for the nsIFocusTracker interface
|
||||
#define NS_IFOCUSTRACKER_IID \
|
||||
{ 0x81ac51d1, 0x923b, 0x11d2, \
|
||||
{ 0x91, 0x8f, 0x0, 0x80, 0xc8, 0xe4, 0x4d, 0xb5 } }
|
||||
|
||||
class nsIFocusTracker : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IFOCUSTRACKER_IID; return iid; }
|
||||
|
||||
/** ScrollFrameIntoView
|
||||
* limited version of nsPresShell::ScrollFrameIntoView
|
||||
* @param aFrame will be the frame to scroll into view.
|
||||
*/
|
||||
NS_IMETHOD ScrollFrameIntoView(nsIFrame *aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Returns the primary frame associated with the content object.
|
||||
*
|
||||
* The primary frame is the frame that is most closely associated with the
|
||||
* content. A frame is more closely associated with the content that another
|
||||
* frame if the one frame contains directly or indirectly the other frame (e.g.,
|
||||
* when a frame is scrolled there is a scroll frame that contains the frame
|
||||
* being scrolled). The primary frame is always the first-in-flow.
|
||||
*
|
||||
* In the case of absolutely positioned elements and floated elements,
|
||||
* the primary frame is the frame that is out of the flow and not the
|
||||
* placeholder frame.
|
||||
*/
|
||||
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame** aPrimaryFrame) const = 0;
|
||||
|
||||
/**
|
||||
* GetPresContent will return the nsIPresContext Interface from this
|
||||
* FocusTracker
|
||||
* usefull for getting screen coordinates of current selection
|
||||
*/
|
||||
NS_IMETHOD GetPresContext(nsIPresContext **aContext) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif //nsIFocusTracker_h___
|
||||
1156
mozilla/layout/base/public/nsIFrame.h
Normal file
1156
mozilla/layout/base/public/nsIFrame.h
Normal file
File diff suppressed because it is too large
Load Diff
129
mozilla/layout/base/public/nsIFrameDebug.h
Normal file
129
mozilla/layout/base/public/nsIFrameDebug.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/* -*- 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 nsIFrameDebug_h___
|
||||
#define nsIFrameDebug_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
|
||||
// IID for the nsIFrameDebug interface {a6cf9069-15b3-11d2-932e-00805f8add32}
|
||||
#define NS_IFRAMEDEBUG_IID \
|
||||
{ 0xa6cf9069, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* Debug related functions
|
||||
*/
|
||||
class nsIFrameDebug : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IFRAMEDEBUG_IID; return iid; }
|
||||
|
||||
NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const = 0;
|
||||
|
||||
/**
|
||||
* Get a printable from of the name of the frame type.
|
||||
* XXX This should be eliminated and we use GetFrameType() instead...
|
||||
*/
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const = 0;
|
||||
/**
|
||||
* Called to dump out regression data that describes the layout
|
||||
* of the frame and it's children, and so on. The format of the
|
||||
* data is dictated to be XML (using a specific DTD); the
|
||||
* specific kind of data dumped is up to the frame itself, with
|
||||
* the caveat that some base types are defined.
|
||||
* For more information, see XXX.
|
||||
*
|
||||
* Argument aIncludeStyleData: if PR_TRUE, style information is dumpted, otherwise it is not
|
||||
*/
|
||||
NS_IMETHOD DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData) = 0;
|
||||
|
||||
/**
|
||||
* Get the size of the frame object. The size value should include
|
||||
* all subordinate data referenced by the frame that is not
|
||||
* accounted for by child frames. However, this value should not
|
||||
* include the content objects, style contexts, views or other data
|
||||
* that lies logically outside the frame system.
|
||||
*
|
||||
* If the implementation so chooses, instead of returning the total
|
||||
* subordinate data it may instead use the sizeof handler to store
|
||||
* away subordinate data under its own key so that the subordinate
|
||||
* data may be tabulated independently of the frame itself.
|
||||
*
|
||||
* The caller is responsible for recursing over all child-lists that
|
||||
* the frame supports.
|
||||
*/
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0;
|
||||
|
||||
NS_IMETHOD VerifyTree() const = 0;
|
||||
|
||||
/**
|
||||
* See if tree verification is enabled. To enable tree verification add
|
||||
* "frameverifytree:1" to your NSPR_LOG_MODULES environment variable
|
||||
* (any non-zero debug level will work). Or, call SetVerifyTreeEnable
|
||||
* with PR_TRUE.
|
||||
*/
|
||||
static NS_LAYOUT PRBool GetVerifyTreeEnable();
|
||||
|
||||
/**
|
||||
* Set the verify-tree enable flag.
|
||||
*/
|
||||
static NS_LAYOUT void SetVerifyTreeEnable(PRBool aEnabled);
|
||||
|
||||
/**
|
||||
* See if style tree verification is enabled. To enable style tree
|
||||
* verification add "styleverifytree:1" to your NSPR_LOG_MODULES
|
||||
* environment variable (any non-zero debug level will work). Or,
|
||||
* call SetVerifyStyleTreeEnable with PR_TRUE.
|
||||
*/
|
||||
static NS_LAYOUT PRBool GetVerifyStyleTreeEnable();
|
||||
|
||||
/**
|
||||
* Set the verify-style-tree enable flag.
|
||||
*/
|
||||
static NS_LAYOUT void SetVerifyStyleTreeEnable(PRBool aEnabled);
|
||||
|
||||
/**
|
||||
* The frame class and related classes share an nspr log module
|
||||
* for logging frame activity.
|
||||
*
|
||||
* Note: the log module is created during library initialization which
|
||||
* means that you cannot perform logging before then.
|
||||
*/
|
||||
static NS_LAYOUT PRLogModuleInfo* GetLogModuleInfo();
|
||||
|
||||
// Show frame borders when rendering
|
||||
static NS_LAYOUT void ShowFrameBorders(PRBool aEnable);
|
||||
static NS_LAYOUT PRBool GetShowFrameBorders();
|
||||
|
||||
// Show frame border of event target
|
||||
static NS_LAYOUT void ShowEventTargetFrameBorder(PRBool aEnable);
|
||||
static NS_LAYOUT PRBool GetShowEventTargetFrameBorder();
|
||||
|
||||
private:
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
|
||||
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIFrameDebug_h___ */
|
||||
114
mozilla/layout/base/public/nsIFrameImageLoader.h
Normal file
114
mozilla/layout/base/public/nsIFrameImageLoader.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/* -*- 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 nsIFrameImageLoader_h___
|
||||
#define nsIFrameImageLoader_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIImage;
|
||||
class nsIImageGroup;
|
||||
class nsIPresContext;
|
||||
class nsString;
|
||||
struct nsSize;
|
||||
|
||||
/* a6cf90ec-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_IFRAME_IMAGE_LOADER_IID \
|
||||
{ 0xa6cf90ec, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
enum nsImageAnimation {
|
||||
eImageAnimation_Normal = 0, // looping controlled by image
|
||||
eImageAnimation_None = 1, // don't loop; just show first frame
|
||||
eImageAnimation_LoopOnce = 2 // loop just once
|
||||
};
|
||||
|
||||
// Type of callback function used during image loading. The frame
|
||||
// image loader will invoke this callback as notifications occur from
|
||||
// the image library.
|
||||
class nsIFrameImageLoader;
|
||||
typedef nsresult (*nsIFrameImageLoaderCB)(nsIPresContext* aPresContext,
|
||||
nsIFrameImageLoader* aLoader,
|
||||
nsIFrame* aFrame,
|
||||
void* aClosure,
|
||||
PRUint32 aStatus);
|
||||
|
||||
/**
|
||||
* Abstract interface for frame image loaders. Frame image loaders
|
||||
* know how to respond to nsIImageRequestObserver notifications and
|
||||
* generate the appropriate rendering/reflow operation for a target
|
||||
* frame.
|
||||
*/
|
||||
class nsIFrameImageLoader : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() {static nsIID iid = NS_IFRAME_IMAGE_LOADER_IID; return iid;}
|
||||
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIImageGroup* aGroup,
|
||||
const nsString& aURL,
|
||||
const nscolor* aBackgroundColor,
|
||||
const nsSize* aDesiredSize,
|
||||
nsIFrame* aFrame,
|
||||
nsImageAnimation aAnimationMode,
|
||||
nsIFrameImageLoaderCB aCallBack,
|
||||
void* aClosure, void* aKey) = 0;
|
||||
|
||||
NS_IMETHOD StopImageLoad(PRBool aStopChrome = PR_TRUE) = 0;
|
||||
|
||||
NS_IMETHOD AbortImageLoad() = 0;
|
||||
|
||||
NS_IMETHOD IsSameImageRequest(const nsString& aURL,
|
||||
const nscolor* aBackgroundColor,
|
||||
const nsSize* aDesiredSize,
|
||||
PRBool* aResult) = 0;
|
||||
|
||||
NS_IMETHOD AddFrame(nsIFrame* aFrame, nsIFrameImageLoaderCB aCallBack,
|
||||
void* aClosure, void* aKey) = 0;
|
||||
|
||||
NS_IMETHOD RemoveFrame(void* aKey) = 0;
|
||||
|
||||
NS_IMETHOD SafeToDestroy(PRBool* aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetURL(nsString& aResult) = 0;
|
||||
NS_IMETHOD GetPresContext(nsIPresContext** aPresContext) = 0;
|
||||
|
||||
NS_IMETHOD GetImage(nsIImage** aResult) = 0;
|
||||
|
||||
// Return the size of the image, in twips
|
||||
NS_IMETHOD GetSize(nsSize& aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetImageLoadStatus(PRUint32* aLoadStatus) = 0;
|
||||
|
||||
// Return the intrinsic (or natural) size of the image, in twips.
|
||||
// Returns 0,0 if the dimensions are unknown
|
||||
NS_IMETHOD GetIntrinsicSize(nsSize& aResult) = 0;
|
||||
NS_IMETHOD GetNaturalImageSize(PRUint32* naturalWidth, PRUint32 *naturalHeight) = 0;
|
||||
};
|
||||
|
||||
// Image load status bit values
|
||||
#define NS_IMAGE_LOAD_STATUS_NONE 0x0
|
||||
#define NS_IMAGE_LOAD_STATUS_SIZE_AVAILABLE 0x1
|
||||
#define NS_IMAGE_LOAD_STATUS_IMAGE_READY 0x2
|
||||
#define NS_IMAGE_LOAD_STATUS_ERROR 0x4
|
||||
|
||||
#endif /* nsIFrameImageLoader_h___ */
|
||||
259
mozilla/layout/base/public/nsIFrameManager.h
Normal file
259
mozilla/layout/base/public/nsIFrameManager.h
Normal file
@@ -0,0 +1,259 @@
|
||||
/* -*- 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 nsIFrameManager_h___
|
||||
#define nsIFrameManager_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIStatefulFrame.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsIPresShell;
|
||||
class nsIStyleSet;
|
||||
class nsIStyleContext;
|
||||
class nsILayoutHistoryState;
|
||||
class nsStyleChangeList;
|
||||
|
||||
#define NS_IFRAMEMANAGER_IID \
|
||||
{ 0xa6cf9107, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
// Calback function used to destroy the value associated with a
|
||||
// given property. used by RemoveFrameProperty()
|
||||
typedef void
|
||||
(*NSFMPropertyDtorFunc)(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIAtom* aPropertyName,
|
||||
void* aPropertyValue);
|
||||
|
||||
// Option flags for GetFrameProperty() member function
|
||||
#define NS_IFRAME_MGR_REMOVE_PROP 0x0001
|
||||
|
||||
// nsresult error codes for frame property functions
|
||||
#define NS_IFRAME_MGR_PROP_NOT_THERE \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_LAYOUT, 1)
|
||||
|
||||
#define NS_IFRAME_MGR_PROP_OVERWRITTEN \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_LAYOUT, 2)
|
||||
|
||||
/**
|
||||
* Frame manager interface. The frame manager serves two purposes:
|
||||
* <li>provides a serice for mapping from content to frame and from out-of-flow
|
||||
* frame to placeholder frame
|
||||
* <li>handles structural modifications to the frame model. If the frame model
|
||||
* lock can be acquired, then the changes are processed immediately; otherwise,
|
||||
* they're queued and processed later
|
||||
*/
|
||||
class nsIFrameManager : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() {static nsIID iid = NS_IFRAMEMANAGER_IID; return iid;}
|
||||
|
||||
// Initialization
|
||||
NS_IMETHOD Init(nsIPresShell* aPresShell, nsIStyleSet* aStyleSet) = 0;
|
||||
|
||||
/**
|
||||
* After Destroy is called, all methods should return
|
||||
* NS_ERROR_NOT_AVAILABLE. Destroy should be called when the
|
||||
* frame tree managed by the frame manager is no longer being
|
||||
* displayed.
|
||||
*/
|
||||
NS_IMETHOD Destroy() = 0;
|
||||
|
||||
// Gets and sets the root frame (typically the viewport). The lifetime of the
|
||||
// root frame is controlled by the frame manager. When the frame manager is
|
||||
// destroyed it destroys the entire frame hierarchy
|
||||
NS_IMETHOD GetRootFrame(nsIFrame** aRootFrame) const = 0;
|
||||
NS_IMETHOD SetRootFrame(nsIFrame* aRootFrame) = 0;
|
||||
|
||||
// Get the canvas frame. The canvas frame may or may not exist, so the
|
||||
// argument aCanvasFrame may be nsnull.
|
||||
NS_IMETHOD GetCanvasFrame(nsIPresContext* aPresContext, nsIFrame** aCanvasFrame) const = 0;
|
||||
|
||||
// Primary frame functions
|
||||
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aPrimaryFrame) = 0;
|
||||
NS_IMETHOD SetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame* aPrimaryFrame) = 0;
|
||||
NS_IMETHOD ClearPrimaryFrameMap() = 0;
|
||||
|
||||
// Placeholder frame functions
|
||||
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
|
||||
nsIFrame** aPlaceholderFrame) const = 0;
|
||||
NS_IMETHOD SetPlaceholderFrameFor(nsIFrame* aFrame,
|
||||
nsIFrame* aPlaceholderFrame) = 0;
|
||||
NS_IMETHOD ClearPlaceholderFrameMap() = 0;
|
||||
|
||||
// Mapping undisplayed content
|
||||
NS_IMETHOD SetUndisplayedContent(nsIContent* aContent, nsIStyleContext* aStyleContext) = 0;
|
||||
NS_IMETHOD SetUndisplayedPseudoIn(nsIStyleContext* aPseudoContext,
|
||||
nsIContent* aParentContent) = 0;
|
||||
NS_IMETHOD ClearUndisplayedContentIn(nsIContent* aContent, nsIContent* aParentContent) = 0;
|
||||
NS_IMETHOD ClearAllUndisplayedContentIn(nsIContent* aParentContent) = 0;
|
||||
NS_IMETHOD ClearUndisplayedContentMap() = 0;
|
||||
|
||||
// Functions for manipulating the frame model
|
||||
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aFrameList) = 0;
|
||||
NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aPrevFrame,
|
||||
nsIFrame* aFrameList) = 0;
|
||||
NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame) = 0;
|
||||
NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext,
|
||||
nsIPresShell& aPresShell,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame,
|
||||
nsIFrame* aNewFrame) = 0;
|
||||
|
||||
// Notification that we were unable to render a replaced element
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame) = 0;
|
||||
|
||||
// Notification that a frame is about to be destroyed. This allows any outstanding
|
||||
// references to the frame to be cleaned up
|
||||
NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0;
|
||||
|
||||
// reparent the style contexts of this frame sub tree to live under the
|
||||
// new given parent style context
|
||||
NS_IMETHOD ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIStyleContext* aNewParentContext) = 0;
|
||||
|
||||
// Re-resolve style contexts for frame tree
|
||||
NS_IMETHOD ComputeStyleChangeFor(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
PRInt32 aAttrNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
nsStyleChangeList& aChangeList,
|
||||
PRInt32 aMinChange,
|
||||
PRInt32& aTopLevelChange) = 0;
|
||||
|
||||
// Determine whether an attribute affects style
|
||||
NS_IMETHOD AttributeAffectsStyle(nsIAtom *aAttribute, nsIContent *aContent,
|
||||
PRBool &aAffects) = 0;
|
||||
|
||||
/**
|
||||
* Capture/restore frame state for the frame subtree rooted at aFrame.
|
||||
* aState is the document state storage object onto which each frame
|
||||
* stores its state.
|
||||
*/
|
||||
NS_IMETHOD CaptureFrameState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsILayoutHistoryState* aState) = 0;
|
||||
NS_IMETHOD RestoreFrameState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsILayoutHistoryState* aState) = 0;
|
||||
// Add/restore state for one frame (special, global type, like scroll position)
|
||||
NS_IMETHOD CaptureFrameStateFor(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsILayoutHistoryState* aState,
|
||||
nsIStatefulFrame::SpecialStateID aID = nsIStatefulFrame::eNoID) = 0;
|
||||
NS_IMETHOD RestoreFrameStateFor(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsILayoutHistoryState* aState,
|
||||
nsIStatefulFrame::SpecialStateID aID = nsIStatefulFrame::eNoID) = 0;
|
||||
|
||||
/**
|
||||
* Gets a property value for a given frame.
|
||||
*
|
||||
* @param aFrame the frame with the property
|
||||
* @param aPropertyName property name as an atom
|
||||
* @param aOptions optional flags
|
||||
* NS_IFRAME_MGR_REMOVE_PROP removes the property
|
||||
* @param aPropertyValue the property value or 0 if the property is not set
|
||||
* @return NS_OK if the property is set,
|
||||
* NS_IFRAME_MGR_PROP_NOT_THERE if the property is not set
|
||||
*/
|
||||
NS_IMETHOD GetFrameProperty(nsIFrame* aFrame,
|
||||
nsIAtom* aPropertyName,
|
||||
PRUint32 aOptions,
|
||||
void** aPropertyValue) = 0;
|
||||
|
||||
/**
|
||||
* Sets the property value for a given frame.
|
||||
*
|
||||
* A frame may only have one property value at a time for a given property
|
||||
* name. The existing property value (if there is one) is overwritten, and the
|
||||
* old value destroyed
|
||||
*
|
||||
* @param aFrame the frame to set the property on
|
||||
* @param aPropertyName property name as an atom
|
||||
* @param aPropertyValue the property value
|
||||
* @param aPropertyDtorFunc when setting a property you can specify the
|
||||
* dtor function (can be NULL) that will be used
|
||||
* to destroy the property value. There can be only
|
||||
* one dtor function for a given property name
|
||||
* @return NS_OK if successful,
|
||||
* NS_IFRAME_MGR_PROP_OVERWRITTEN if there is an existing property
|
||||
* value that was overwritten,
|
||||
* NS_ERROR_INVALID_ARG if the dtor function does not match the
|
||||
* existing dtor function
|
||||
*/
|
||||
NS_IMETHOD SetFrameProperty(nsIFrame* aFrame,
|
||||
nsIAtom* aPropertyName,
|
||||
void* aPropertyValue,
|
||||
NSFMPropertyDtorFunc aPropertyDtorFunc) = 0;
|
||||
|
||||
/**
|
||||
* Removes a property and destroys its property value by calling the dtor
|
||||
* function associated with the property name.
|
||||
*
|
||||
* When a frame is destroyed any remaining properties are automatically removed
|
||||
*
|
||||
* @param aFrame the frame to set the property on
|
||||
* @param aPropertyName property name as an atom
|
||||
* @return NS_OK if the property is successfully removed,
|
||||
* NS_IFRAME_MGR_PROP_NOT_THERE if the property is not set
|
||||
*/
|
||||
NS_IMETHOD RemoveFrameProperty(nsIFrame* aFrame,
|
||||
nsIAtom* aPropertyName) = 0;
|
||||
|
||||
NS_IMETHOD GetInsertionPoint(nsIPresShell* aShell, nsIFrame* aParent, nsIFrame* aChild, nsIFrame** aResult)=0;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
/**
|
||||
* DEBUG ONLY method to verify integrity of style tree versus frame tree
|
||||
*/
|
||||
NS_IMETHOD DebugVerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a frame manager. Upon success, call Init() before attempting to
|
||||
* use it.
|
||||
*/
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewFrameManager(nsIFrameManager** aInstancePtrResult);
|
||||
|
||||
#endif /* nsIFrameManager_h___ */
|
||||
401
mozilla/layout/base/public/nsIFrameSelection.h
Normal file
401
mozilla/layout/base/public/nsIFrameSelection.h
Normal file
@@ -0,0 +1,401 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* NOTE!! This is not a general class, but specific to layout and frames.
|
||||
* Consumers looking for the general selection interface should look at
|
||||
* nsISelection.
|
||||
*/
|
||||
|
||||
#ifndef nsIFrameSelection_h___
|
||||
#define nsIFrameSelection_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFocusTracker.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
|
||||
// IID for the nsIFrameSelection interface
|
||||
#define NS_IFRAMESELECTION_IID \
|
||||
{ 0xf46e4171, 0xdeaa, 0x11d1, \
|
||||
{ 0x97, 0xfc, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Selection interface
|
||||
|
||||
struct SelectionDetails
|
||||
{
|
||||
PRInt32 mStart;
|
||||
PRInt32 mEnd;
|
||||
SelectionType mType;
|
||||
SelectionDetails *mNext;
|
||||
};
|
||||
|
||||
/*PeekOffsetStruct
|
||||
* @param mTracker is used to get the PresContext usefull for measuring text ect.
|
||||
* @param mDesiredX is the "desired" location of the new caret
|
||||
* @param mAmount eWord, eCharacter, eLine
|
||||
* @param mDirection enum defined in this file to be eForward or eBackward
|
||||
* @param mStartOffset start offset to start the peek. 0 == beginning -1 = end
|
||||
* @param mResultContent content that actually is the next/previous
|
||||
* @param mResultOffset offset for result content
|
||||
* @param mResultFrame resulting frame for peeking
|
||||
* @param mEatingWS boolean to tell us the state of our search for Next/Prev
|
||||
* @param mPreferLeft true = prev line end, false = next line begin
|
||||
* @param mJumpLines if this is true then its ok to cross lines while peeking
|
||||
*/
|
||||
struct nsPeekOffsetStruct
|
||||
{
|
||||
void SetData(nsIFocusTracker *aTracker,
|
||||
nscoord aDesiredX,
|
||||
nsSelectionAmount aAmount,
|
||||
nsDirection aDirection,
|
||||
PRInt32 aStartOffset,
|
||||
PRBool aEatingWS,
|
||||
PRBool aPreferLeft,
|
||||
PRBool aJumpLines)
|
||||
{
|
||||
mTracker=aTracker;mDesiredX=aDesiredX;mAmount=aAmount;
|
||||
mDirection=aDirection;mStartOffset=aStartOffset;mEatingWS=aEatingWS;
|
||||
mPreferLeft=aPreferLeft;mJumpLines = aJumpLines;
|
||||
}
|
||||
nsIFocusTracker *mTracker;
|
||||
nscoord mDesiredX;
|
||||
nsSelectionAmount mAmount;
|
||||
nsDirection mDirection;
|
||||
PRInt32 mStartOffset;
|
||||
nsCOMPtr<nsIContent> mResultContent;
|
||||
PRInt32 mContentOffset;
|
||||
PRInt32 mContentOffsetEnd;
|
||||
nsIFrame *mResultFrame;
|
||||
PRBool mEatingWS;
|
||||
PRBool mPreferLeft;
|
||||
PRBool mJumpLines;
|
||||
};
|
||||
|
||||
class nsIScrollableView;
|
||||
|
||||
|
||||
class nsIFrameSelection : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IFRAMESELECTION_IID; return iid; }
|
||||
enum HINT {HINTLEFT=0,HINTRIGHT=1}mHint;//end of this line or beginning of next
|
||||
|
||||
/** Init will initialize the frame selector with the necessary focus tracker to
|
||||
* be used by most of the methods
|
||||
* @param aTracker is the parameter to be used for most of the other calls for callbacks ect
|
||||
* @param aLimiter limits the selection to nodes with aLimiter parents
|
||||
*/
|
||||
NS_IMETHOD Init(nsIFocusTracker *aTracker, nsIContent *aLimiter) = 0; //default since this isnt used for embedding
|
||||
|
||||
/* SetScrollView sets the scroll view
|
||||
* @param aScrollView is thr scroll view for this selection.
|
||||
*/
|
||||
NS_IMETHOD SetScrollableView(nsIScrollableView *aScrollView) =0;
|
||||
|
||||
/** ShutDown will be called when the owner of the frame selection is shutting down
|
||||
* this should be the time to release all member variable interfaces. all methods
|
||||
* called after ShutDown should return NS_ERROR_FAILURE
|
||||
*/
|
||||
NS_IMETHOD ShutDown() = 0;
|
||||
|
||||
/** HandleKeyEvent will accept an event and frame and
|
||||
* will return NS_OK if it handles the event or NS_COMFALSE if not.
|
||||
* <P>DOES NOT ADDREF<P>
|
||||
* @param aGuiEvent is the event that should be dealt with by aFocusFrame
|
||||
* @param aFrame is the frame that MAY handle the event
|
||||
*/
|
||||
NS_IMETHOD HandleTextEvent(nsGUIEvent *aGuiEvent) = 0;
|
||||
|
||||
/** HandleKeyEvent will accept an event and frame and
|
||||
* will return NS_OK if it handles the event or NS_COMFALSE if not.
|
||||
* <P>DOES NOT ADDREF<P>
|
||||
* @param aGuiEvent is the event that should be dealt with by aFocusFrame
|
||||
* @param aFrame is the frame that MAY handle the event
|
||||
*/
|
||||
NS_IMETHOD HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent) = 0;
|
||||
|
||||
/** HandleClick will take the focus to the new frame at the new offset and
|
||||
* will either extend the selection from the old anchor, or replace the old anchor.
|
||||
* the old anchor and focus position may also be used to deselect things
|
||||
* @param aNewfocus is the content that wants the focus
|
||||
* @param aContentOffset is the content offset of the parent aNewFocus
|
||||
* @param aContentOffsetEnd is the content offset of the parent aNewFocus and is specified different
|
||||
* when you need to select to and include both start and end points
|
||||
* @param aContinueSelection is the flag that tells the selection to keep the old anchor point or not.
|
||||
* @param aMultipleSelection will tell the frame selector to replace /or not the old selection.
|
||||
* cannot coexist with aContinueSelection
|
||||
* @param aHint will tell the selection which direction geometrically to actually show the caret on.
|
||||
* 1 = end of this line 0 = beggining of this line
|
||||
*/
|
||||
NS_IMETHOD HandleClick(nsIContent *aNewFocus, PRUint32 aContentOffset, PRUint32 aContentEndOffset ,
|
||||
PRBool aContinueSelection, PRBool aMultipleSelection, PRBool aHint) = 0;
|
||||
|
||||
/** HandleDrag extends the selection to contain the frame closest to aPoint.
|
||||
* @param aPresContext is the context to use when figuring out what frame contains the point.
|
||||
* @param aFrame is the parent of all frames to use when searching for the closest frame to the point.
|
||||
* @param aPoint is relative to aFrame's parent view.
|
||||
*/
|
||||
NS_IMETHOD HandleDrag(nsIPresContext *aPresContext, nsIFrame *aFrame, nsPoint& aPoint) = 0;
|
||||
|
||||
/** HandleTableSelection will set selection to a table, cell, etc
|
||||
* depending on information contained in aFlags
|
||||
* @param aParentContent is the paretent of either a table or cell that user clicked or dragged the mouse in
|
||||
* @param aContentOffset is the offset of the table or cell
|
||||
* @param aTarget indicates what to select (defined in nsISelectionPrivate.idl/nsISelectionPrivate.h):
|
||||
* TABLESELECTION_CELL We should select a cell (content points to the cell)
|
||||
* TABLESELECTION_ROW We should select a row (content points to any cell in row)
|
||||
* TABLESELECTION_COLUMN We should select a row (content points to any cell in column)
|
||||
* TABLESELECTION_TABLE We should select a table (content points to the table)
|
||||
* TABLESELECTION_ALLCELLS We should select all cells (content points to any cell in table)
|
||||
* @param aMouseEvent passed in so we we can get where event occured and what keys are pressed
|
||||
*/
|
||||
NS_IMETHOD HandleTableSelection(nsIContent *aParentContent, PRInt32 aContentOffset, PRInt32 aTarget, nsMouseEvent *aMouseEvent) = 0;
|
||||
|
||||
/** StartAutoScrollTimer is responsible for scrolling the view so that aPoint is always
|
||||
* visible, and for selecting any frame that contains aPoint. The timer will also reset
|
||||
* itself to fire again if the view has not scrolled to the end of the document.
|
||||
* @param aPresContext is the context to use when figuring out what frame contains the point.
|
||||
* @param aFrame is the parent of all frames to use when searching for the closest frame to the point.
|
||||
* @param aPoint is relative to aFrame's parent view.
|
||||
* @param aDelay is the timer's interval.
|
||||
*/
|
||||
NS_IMETHOD StartAutoScrollTimer(nsIPresContext *aPresContext, nsIFrame *aFrame, nsPoint& aPoint, PRUint32 aDelay) = 0;
|
||||
|
||||
/** StopAutoScrollTimer stops any active auto scroll timer.
|
||||
*/
|
||||
NS_IMETHOD StopAutoScrollTimer() = 0;
|
||||
|
||||
/** EnableFrameNotification
|
||||
* mutch like start batching, except all dirty calls are ignored. no notifications will go
|
||||
* out until enableNotifications with a PR_TRUE is called
|
||||
*/
|
||||
NS_IMETHOD EnableFrameNotification(PRBool aEnable) = 0;
|
||||
|
||||
/** Lookup Selection
|
||||
* returns in frame coordinates the selection beginning and ending with the type of selection given
|
||||
* @param aContent is the content asking
|
||||
* @param aContentOffset is the starting content boundary
|
||||
* @param aContentLength is the length of the content piece asking
|
||||
* @param aReturnDetails linkedlist of return values for the selection.
|
||||
* @param aSlowCheck will check using slow method with no shortcuts
|
||||
*/
|
||||
NS_IMETHOD LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PRInt32 aContentLength,
|
||||
SelectionDetails **aReturnDetails, PRBool aSlowCheck) = 0;
|
||||
|
||||
/** SetMouseDownState(PRBool);
|
||||
* sets the mouse state to aState for resons of drag state.
|
||||
* @param aState is the new state of mousedown
|
||||
*/
|
||||
NS_IMETHOD SetMouseDownState(PRBool aState)=0;
|
||||
|
||||
/** GetMouseDownState(PRBool *);
|
||||
* gets the mouse state to aState for resons of drag state.
|
||||
* @param aState will hold the state of mousedown
|
||||
*/
|
||||
NS_IMETHOD GetMouseDownState(PRBool *aState)=0;
|
||||
|
||||
/**
|
||||
if we are in table cell selection mode. aka ctrl click in table cell
|
||||
*/
|
||||
NS_IMETHOD GetTableCellSelection(PRBool *aState)=0;
|
||||
|
||||
/** GetTableCellSelectionStyleColor
|
||||
* this holds the color of the selection for table cells when they are selected.
|
||||
*/
|
||||
NS_IMETHOD GetTableCellSelectionStyleColor(const nsStyleColor **aStyleColor)=0;
|
||||
|
||||
/** GetSelection
|
||||
* no query interface for selection. must use this method now.
|
||||
* @param aSelectionType enum value defined in nsISelection for the seleciton you want.
|
||||
*/
|
||||
NS_IMETHOD GetSelection(SelectionType aSelectionType, nsISelection **aSelection)=0;
|
||||
|
||||
/**
|
||||
* ScrollSelectionIntoView scrolls a region of the selection,
|
||||
* so that it is visible in the scrolled view.
|
||||
*
|
||||
* @param aType the selection to scroll into view.
|
||||
* @param aRegion the region inside the selection to scroll into view.
|
||||
*/
|
||||
NS_IMETHOD ScrollSelectionIntoView(SelectionType aSelectionType, SelectionRegion aRegion)=0;
|
||||
|
||||
/** RepaintSelection repaints the selected frames that are inside the selection
|
||||
* specified by aSelectionType.
|
||||
* @param aSelectionType enum value defined in nsISelection for the seleciton you want.
|
||||
*/
|
||||
NS_IMETHOD RepaintSelection(nsIPresContext* aPresContext, SelectionType aSelectionType)=0;
|
||||
|
||||
/** GetFrameForNodeOffset given a node and its child offset, return the nsIFrame and
|
||||
* the offset into that frame.
|
||||
* @param aNode input parameter for the node to look at
|
||||
* @param aOffset offset into above node.
|
||||
* @param aReturnFrame will contain the return frame. MUST NOT BE NULL or will return error
|
||||
* @param aReturnOffset will contain offset into frame.
|
||||
*/
|
||||
NS_IMETHOD GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, HINT aHint, nsIFrame **aReturnFrame, PRInt32 *aReturnOffset)=0;
|
||||
|
||||
/** AdjustOffsetsFromStyle. Called after detecting that a click or drag will
|
||||
* select the frame, this function looks for user-select style on that frame or a parent
|
||||
* frame, and adjust the content and offsets accordingly.
|
||||
* @param aFrame the frame that was clicked
|
||||
* @param outContent content node to be selected
|
||||
* @param outStartOffset selection start offset
|
||||
* @param outEndOffset selection end offset
|
||||
*/
|
||||
NS_IMETHOD AdjustOffsetsFromStyle(nsIFrame *aFrame, PRBool *changeSelection,
|
||||
nsIContent** outContent, PRInt32* outStartOffset, PRInt32* outEndOffset)=0;
|
||||
|
||||
|
||||
NS_IMETHOD GetHint(HINT *aHint)=0;
|
||||
NS_IMETHOD SetHint(HINT aHint)=0;
|
||||
|
||||
/** CharacterMove will generally be called from the nsiselectioncontroller implementations.
|
||||
* the effect being the selection will move one character left or right.
|
||||
* @param aForward move forward in document.
|
||||
* @param aExtend continue selection
|
||||
*/
|
||||
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend)=0;
|
||||
|
||||
/** WordMove will generally be called from the nsiselectioncontroller implementations.
|
||||
* the effect being the selection will move one word left or right.
|
||||
* @param aForward move forward in document.
|
||||
* @param aExtend continue selection
|
||||
*/
|
||||
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend)=0;
|
||||
|
||||
/** LineMove will generally be called from the nsiselectioncontroller implementations.
|
||||
* the effect being the selection will move one line up or down.
|
||||
* @param aForward move forward in document.
|
||||
* @param aExtend continue selection
|
||||
*/
|
||||
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend)=0;
|
||||
|
||||
/** IntraLineMove will generally be called from the nsiselectioncontroller implementations.
|
||||
* the effect being the selection will move to beginning or end of line
|
||||
* @param aForward move forward in document.
|
||||
* @param aExtend continue selection
|
||||
*/
|
||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend)=0;
|
||||
|
||||
/** Select All will generally be called from the nsiselectioncontroller implementations.
|
||||
* it will select the whole doc
|
||||
*/
|
||||
NS_IMETHOD SelectAll()=0;
|
||||
|
||||
/** Sets/Gets The display selection enum.
|
||||
*/
|
||||
NS_IMETHOD SetDisplaySelection(PRInt16 aState)=0;
|
||||
NS_IMETHOD GetDisplaySelection(PRInt16 *aState)=0;
|
||||
|
||||
/** Allow applications to specify how we should place the caret
|
||||
* when the user clicks over an existing selection. A aDelay
|
||||
* value of PR_TRUE means delay clearing the selection and
|
||||
* placing the caret until MouseUp, when the user clicks over
|
||||
* an existing selection. This is especially usefull when applications
|
||||
* want to support Drag & Drop of the current selection. A value
|
||||
* of PR_FALSE means place the caret immediately. If the application
|
||||
* never calls this method, the nsIFrameSelection implementation
|
||||
* assumes the default value is PR_TRUE.
|
||||
* @param aDelay PR_TRUE if we should delay caret placement.
|
||||
*/
|
||||
NS_IMETHOD SetDelayCaretOverExistingSelection(PRBool aDelay)=0;
|
||||
|
||||
/** Get the current delay caret setting. If aDelay contains
|
||||
* a return value of PR_TRUE, the caret is placed on MouseUp
|
||||
* when clicking over an existing selection. If PR_FALSE,
|
||||
* the selection is cleared and caret is placed immediately
|
||||
* in all cases.
|
||||
* @param aDelay will contain the return value.
|
||||
*/
|
||||
NS_IMETHOD GetDelayCaretOverExistingSelection(PRBool *aDelay)=0;
|
||||
|
||||
/** If we are delaying caret placement til MouseUp (see
|
||||
* Set/GetDelayCaretOverExistingSelection()), this method
|
||||
* can be used to store the data received during the MouseDown
|
||||
* so that we can place the caret during the MouseUp event.
|
||||
* @aMouseEvent the event received by the selection MouseDown
|
||||
* handling method. A NULL value can be use to tell this method
|
||||
* that any data is storing is no longer valid.
|
||||
*/
|
||||
NS_IMETHOD SetDelayedCaretData(nsMouseEvent *aMouseEvent)=0;
|
||||
|
||||
/** Get the delayed MouseDown event data neccessary to place the
|
||||
* caret during MouseUp processing.
|
||||
* @aMouseEvent will contain a pointer to the event received
|
||||
* by the selection during MouseDown processing. It can be NULL
|
||||
* if the data is no longer valid.
|
||||
*/
|
||||
NS_IMETHOD GetDelayedCaretData(nsMouseEvent **aMouseEvent)=0;
|
||||
|
||||
|
||||
/** Get the content node that limits the selection
|
||||
* When searching up a nodes for parents, as in a text edit field
|
||||
* in an browser page, we must stop at this node else we reach into the
|
||||
* parent page, which is very bad!
|
||||
*/
|
||||
NS_IMETHOD GetLimiter(nsIContent **aLimiterContent)=0;
|
||||
|
||||
#ifdef IBMBIDI
|
||||
/** GetPrevNextBidiLevels will return the frames and associated Bidi levels of the characters
|
||||
* logically before and after a (collapsed) selection.
|
||||
* @param aPresContext is the context to use
|
||||
* @param aNode is the node containing the selection
|
||||
* @param aContentOffset is the offset of the selection in the node
|
||||
* @param aPrevFrame will hold the frame of the character before the selection
|
||||
* @param aNextFrame will hold the frame of the character after the selection
|
||||
* @param aPrevLevel will hold the Bidi level of the character before the selection
|
||||
* @param aNextLevel will hold the Bidi level of the character after the selection
|
||||
*
|
||||
* At the beginning and end of each line there is assumed to be a frame with Bidi level equal to the
|
||||
* paragraph embedding level. In these cases aPrevFrame and aNextFrame respectively will return nsnull.
|
||||
*/
|
||||
NS_IMETHOD GetPrevNextBidiLevels(nsIPresContext *aPresContext, nsIContent *aNode, PRUint32 aContentOffset,
|
||||
nsIFrame **aPrevFrame, nsIFrame **aNextFrame, PRUint8 *aPrevLevel, PRUint8 *aNextLevel)=0;
|
||||
|
||||
/** GetFrameFromLevel will scan in a given direction
|
||||
* until it finds a frame with a Bidi level less than or equal to a given level.
|
||||
* It will return the last frame before this.
|
||||
* @param aPresContext is the context to use
|
||||
* @param aFrameIn is the frame to start from
|
||||
* @param aDirection is the direction to scan
|
||||
* @param aBidiLevel is the level to search for
|
||||
* @param aFrameOut will hold the frame returned
|
||||
*/
|
||||
NS_IMETHOD GetFrameFromLevel(nsIPresContext *aPresContext, nsIFrame *aFrameIn, nsDirection aDirection, PRUint8 aBidiLevel,
|
||||
nsIFrame **aFrameOut)=0;
|
||||
|
||||
#endif // IBMBIDI
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* nsIFrameSelection_h___ */
|
||||
51
mozilla/layout/base/public/nsIFrameTraversal.h
Normal file
51
mozilla/layout/base/public/nsIFrameTraversal.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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 NSIFRAMETRAVERSAL_H
|
||||
#define NSIFRAMETRAVERSAL_H
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
enum nsTraversalType{LEAF, EXTENSIVE, FASTEST
|
||||
#ifdef IBMBIDI // Simon
|
||||
, VISUAL
|
||||
#endif
|
||||
};
|
||||
|
||||
// {1691E1F3-EE41-11d4-9885-00C04FA0CF4B}
|
||||
#define NS_IFRAMETRAVERSAL_IID \
|
||||
{ 0x1691e1f3, 0xee41, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
|
||||
|
||||
class nsIFrameTraversal : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAMETRAVERSAL_IID)
|
||||
|
||||
NS_IMETHOD NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
|
||||
PRUint32 aType,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame *aStart) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif //NSIFRAMETRAVERSAL_H
|
||||
56
mozilla/layout/base/public/nsIFrameUtil.h
Normal file
56
mozilla/layout/base/public/nsIFrameUtil.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- 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 Communicator client 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 nsIFrameUtil_h___
|
||||
#define nsIFrameUtil_h___
|
||||
|
||||
#include "nsIXMLContent.h"
|
||||
class nsIURI;
|
||||
|
||||
/* a6cf90d4-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_IFRAME_UTIL_IID \
|
||||
{ 0xa6cf90d6, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* Frame utility interface
|
||||
*/
|
||||
class nsIFrameUtil : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAME_UTIL_IID)
|
||||
/**
|
||||
* Compare two regression data dumps. The return status will be NS_OK
|
||||
* if the trees compare favoribly, otherwise the return will indicate
|
||||
* NS_ERROR_FAILURE. Other return status's will indicate some other
|
||||
* type of failure. The files, aFile1 and aFile2 are closed before
|
||||
* returning.
|
||||
*/
|
||||
NS_IMETHOD CompareRegressionData(FILE* aFile1, FILE* aFile2) = 0;
|
||||
|
||||
/**
|
||||
* Display the regression dump data stored in aInputFile1 to
|
||||
* aOutputFile . The file is closed before returning. If the
|
||||
* regression data is in error somehow then NS_ERROR_FAILURE will be
|
||||
* returned.
|
||||
*/
|
||||
NS_IMETHOD DumpRegressionData(FILE* aInputFile, FILE* aOutputFile) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIFrameUtil_h___ */
|
||||
81
mozilla/layout/base/public/nsIImageFrame.h
Normal file
81
mozilla/layout/base/public/nsIImageFrame.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* -*- 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 nsIImageFrame_h___
|
||||
#define nsIImageFrame_h___
|
||||
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
class nsIFrame;
|
||||
struct nsHTMLReflowState;
|
||||
struct nsHTMLReflowMetrics;
|
||||
struct nsSize;
|
||||
|
||||
// {B261A0D5-E696-11d4-9885-00C04FA0CF4B}
|
||||
#define NS_IIMAGEFRAME_IID \
|
||||
{ 0xb261a0d5, 0xe696, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
|
||||
|
||||
class nsIImageFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IIMAGEFRAME_IID)
|
||||
|
||||
NS_IMETHOD Destroy(nsIPresContext* aPresContext) = 0;
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow) = 0;
|
||||
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer) = 0;
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus) = 0;
|
||||
NS_IMETHOD GetContentForEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIContent** aContent) = 0;
|
||||
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus) = 0;
|
||||
NS_IMETHOD GetCursor(nsIPresContext* aPresContext,
|
||||
nsPoint& aPoint,
|
||||
PRInt32& aCursor) = 0;
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) = 0;
|
||||
NS_IMETHOD GetFrameType(nsIAtom** aResult) const = 0;
|
||||
NS_IMETHOD GetIntrinsicImageSize(nsSize& aSize) = 0;
|
||||
|
||||
NS_IMETHOD GetNaturalImageSize(PRUint32* naturalWidth,
|
||||
PRUint32 *naturalHeight) = 0;
|
||||
|
||||
NS_IMETHOD IsImageComplete(PRBool* aComplete) = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* nsIImageFrame_h___ */
|
||||
58
mozilla/layout/base/public/nsIIndependentSelection.h
Normal file
58
mozilla/layout/base/public/nsIIndependentSelection.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* NOTE!! This is not a general class, but specific to layout and frames.
|
||||
* Consumers looking for the general selection interface should look at
|
||||
* nsISelection.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsIIndependentSelection_h___
|
||||
#define nsIIndependentSelection_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#define NS_IINDEPENDENTSELECTION_IID \
|
||||
/* {3B7ABF61-33DB-4a47-8FFA-FFD6EA47CB1A} */ \
|
||||
{ 0x3b7abf61, 0x33db, 0x4a47, \
|
||||
{ 0x8f, 0xfa, 0xff, 0xd6, 0xea, 0x47, 0xcb, 0x1a } }
|
||||
|
||||
|
||||
|
||||
/*This interface is used to allow nsDOMSelection become more of an independent entity from nsSelection. */
|
||||
class nsIIndependentSelection: public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IINDEPENDENTSELECTION_IID; return iid; }
|
||||
|
||||
/** SetPresShell
|
||||
* this method sets the internal pres shell to aPresShell
|
||||
* @param aPresShell weak reference should be kept to this.
|
||||
*/
|
||||
NS_IMETHOD SetPresShell(nsIPresShell *aPresShell) =0;
|
||||
};
|
||||
|
||||
#endif //nsIIndependentSelection_h___
|
||||
60
mozilla/layout/base/public/nsILayoutDebugger.h
Normal file
60
mozilla/layout/base/public/nsILayoutDebugger.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -*- 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 Communicator client 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 nsILayoutDebugger_h___
|
||||
#define nsILayoutDebugger_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIDocument;
|
||||
class nsIPresShell;
|
||||
|
||||
/* a6cf90f8-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_ILAYOUT_DEBUGGER_IID \
|
||||
{ 0xa6cf90f8, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* API for access and control of layout debugging
|
||||
*/
|
||||
class nsILayoutDebugger : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILAYOUT_DEBUGGER_IID)
|
||||
|
||||
NS_IMETHOD SetShowFrameBorders(PRBool aEnable) = 0;
|
||||
|
||||
NS_IMETHOD GetShowFrameBorders(PRBool* aResult) = 0;
|
||||
|
||||
NS_IMETHOD SetShowEventTargetFrameBorder(PRBool aEnable) = 0;
|
||||
|
||||
NS_IMETHOD GetShowEventTargetFrameBorder(PRBool* aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetContentSize(nsIDocument* aDocument,
|
||||
PRInt32* aSizeInBytesResult) = 0;
|
||||
|
||||
NS_IMETHOD GetFrameSize(nsIPresShell* aPresentation,
|
||||
PRInt32* aSizeInBytesResult) = 0;
|
||||
|
||||
NS_IMETHOD GetStyleSize(nsIPresShell* aPresentation,
|
||||
PRInt32* aSizeInBytesResult) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsILayoutDebugger_h___ */
|
||||
27
mozilla/layout/base/public/nsILayoutHistoryState.h
Normal file
27
mozilla/layout/base/public/nsILayoutHistoryState.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef _nsILayoutHistoryState_h
|
||||
#define _nsILayoutHistoryState_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIStatefulFrame.h" // Get StateType enum
|
||||
#include "nsIPresState.h"
|
||||
|
||||
#define NS_ILAYOUTHISTORYSTATE_IID_STR "306c8ca0-5f0c-11d3-a9fb-000064657374"
|
||||
|
||||
#define NS_ILAYOUTHISTORYSTATE_IID \
|
||||
{0x306c8ca0, 0x5f0c, 0x11d3, \
|
||||
{0xa9, 0xfb, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
|
||||
|
||||
class nsILayoutHistoryState : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILAYOUTHISTORYSTATE_IID)
|
||||
|
||||
NS_IMETHOD AddState(PRUint32 aContentID, nsIPresState* aState, nsIStatefulFrame::StateType aStateType) = 0;
|
||||
NS_IMETHOD GetState(PRUint32 aContentID, nsIPresState** aState, nsIStatefulFrame::StateType aStateType) = 0;
|
||||
NS_IMETHOD RemoveState(PRUint32 aContentID, nsIStatefulFrame::StateType aStateType) = 0;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewLayoutHistoryState(nsILayoutHistoryState** aState);
|
||||
|
||||
#endif /* _nsILayoutHistoryState_h */
|
||||
|
||||
53
mozilla/layout/base/public/nsIMutableStyleContext.h
Normal file
53
mozilla/layout/base/public/nsIMutableStyleContext.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* -*- 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 nsIMutableStyleContext_h___
|
||||
#define nsIMutableStyleContext_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsStyleStruct.h"
|
||||
|
||||
|
||||
#define NS_IMUTABLESTYLECONTEXT_IID \
|
||||
{ 0x53cbb100, 0x8340, 0x11d3, \
|
||||
{0xba, 0x05, 0x00, 0x10, 0x83, 0x02, 0x3c, 0x2b} }
|
||||
|
||||
|
||||
class nsIMutableStyleContext : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IMUTABLESTYLECONTEXT_IID; return iid; }
|
||||
|
||||
virtual nsIStyleContext* GetParent(void) const = 0;
|
||||
|
||||
// Fill a style struct with data
|
||||
NS_IMETHOD GetStyle(nsStyleStructID aSID, nsStyleStruct& aStruct) const = 0;
|
||||
NS_IMETHOD SetStyle(nsStyleStructID aSID, const nsStyleStruct& aStruct) = 0;
|
||||
|
||||
//------------------------------------------------
|
||||
// TEMP methods these are here only to ease the transition
|
||||
// to the newer Get/SetStyle APIs above. Don't call these.
|
||||
// get a style data struct by ID
|
||||
virtual const nsStyleStruct* GetStyleData(nsStyleStructID aSID) = 0;
|
||||
virtual nsStyleStruct* GetMutableStyleData(nsStyleStructID aSID) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIMutableStyleContext_h___ */
|
||||
75
mozilla/layout/base/public/nsIObjectFrame.h
Normal file
75
mozilla/layout/base/public/nsIObjectFrame.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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 nsIObjectFrame_h___
|
||||
#define nsIObjectFrame_h___
|
||||
|
||||
class nsIPresContext;
|
||||
class nsIPluginInstance;
|
||||
|
||||
// {6D10B07D-E75B-11d4-9885-00C04FA0CF4B}
|
||||
#define NS_IOBJECTFRAME_IID \
|
||||
{ 0x6d10b07d, 0xe75b, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
|
||||
|
||||
class nsIObjectFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IOBJECTFRAME_IID)
|
||||
|
||||
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList) = 0;
|
||||
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIStyleContext* aContext,
|
||||
nsIFrame* aPrevInFlow) = 0;
|
||||
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus) = 0;
|
||||
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
|
||||
nsDidReflowStatus aStatus) = 0;
|
||||
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer) = 0;
|
||||
|
||||
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus) = 0;
|
||||
|
||||
NS_IMETHOD Scrolled(nsIView *aView) = 0;
|
||||
NS_IMETHOD GetFrameType(nsIAtom** aType) const = 0;
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsString& aResult) const = 0;
|
||||
#endif
|
||||
|
||||
NS_IMETHOD Destroy(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
nsISupports* aSubContent) = 0;
|
||||
|
||||
NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsIObjectFrame_h___ */
|
||||
148
mozilla/layout/base/public/nsIPageSequenceFrame.h
Normal file
148
mozilla/layout/base/public/nsIPageSequenceFrame.h
Normal file
@@ -0,0 +1,148 @@
|
||||
/* -*- 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 nsIPageSequenceFrame_h___
|
||||
#define nsIPageSequenceFrame_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsIPresContext;
|
||||
class nsIPrintOptions;
|
||||
|
||||
// IID for the nsIPageSequenceFrame interface
|
||||
// a6cf90d2-15b3-11d2-932e-00805f8add32
|
||||
#define NS_IPAGESEQUENCEFRAME_IID \
|
||||
{ 0xa6cf90d2, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
// IID for the nsIPrintStatusCallback interface
|
||||
// a6cf90d3-15b3-11d2-932e-00805f8add32
|
||||
#define NS_IPRINTSTATUSCALLBACK_IID \
|
||||
{ 0xa6cf90d3, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* List of status codes that provide additional information about the
|
||||
* progress of the print operation.
|
||||
* @see nsIPrintStatusCallback#OnProgress()
|
||||
*/
|
||||
enum nsPrintStatus {
|
||||
ePrintStatus_StartPage, // beginning the specified page
|
||||
ePrintStatus_EndPage // finished with the specified page
|
||||
};
|
||||
|
||||
/**
|
||||
* List of print error codes.
|
||||
* @see nsIPrintStatusCallback##OnError()
|
||||
*/
|
||||
enum nsPrintError {
|
||||
ePrintError_Error, // unspecified error
|
||||
ePrintError_Abort, // operation was aborted by the user
|
||||
ePrintError_OutOfDisk, // system is out of disk space
|
||||
ePrintError_OutOfMemory // system is out of memory
|
||||
};
|
||||
|
||||
/**
|
||||
* The page sequence frame provides information on the print operation by
|
||||
* calling notification methods on the client's nsIPrintStatusCallback
|
||||
* interface.
|
||||
*/
|
||||
class nsIPrintStatusCallback : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRINTSTATUSCALLBACK_IID)
|
||||
|
||||
/**
|
||||
* Indicates the current progress of the print operation.
|
||||
*
|
||||
* @param aPageNumber the number of the current page
|
||||
* @param aTotalPages the total number of pages
|
||||
* @param aStatusCode additional information regarding the progress
|
||||
* @param aContinuePrinting return PR_TRUE to continue printing and
|
||||
* PR_FALSE to cancel the printing operation
|
||||
*/
|
||||
NS_IMETHOD OnProgress(PRInt32 aPageNumber,
|
||||
PRInt32 aTotalPages,
|
||||
nsPrintStatus aStatusCode,
|
||||
PRBool& aContinuePrinting) = 0;
|
||||
|
||||
/**
|
||||
* Notification that an error has occured.
|
||||
*/
|
||||
NS_IMETHOD OnError(nsPrintError aErrorCode) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Interface for accessing special capabilities of the page sequence frame.
|
||||
*
|
||||
* Today all that exists are member functions for printing.
|
||||
*/
|
||||
class nsIPageSequenceFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPAGESEQUENCEFRAME_IID)
|
||||
|
||||
/**
|
||||
* Print the set of pages.
|
||||
*
|
||||
* @param aPrintOptions options for printing
|
||||
* @param aStatusCallback interface that the client provides to receive
|
||||
* progress notifications. Can be NULL
|
||||
* @return NS_OK if successful
|
||||
* NS_ERROR_ABORT if the client cancels printing using the callback
|
||||
* interface
|
||||
* NS_ERROR_INVALID_ARG if printing a range of pages (not all pages)
|
||||
* and the start page is greater than the total number of pages
|
||||
* NS_ERROR_FAILURE if there is an error
|
||||
* @see nsIPrintStatusCallback#OnProgress()
|
||||
*/
|
||||
NS_IMETHOD Print(nsIPresContext* aPresContext,
|
||||
nsIPrintOptions* aPrintOptions,
|
||||
nsIPrintStatusCallback* aStatusCallback) = 0;
|
||||
|
||||
NS_IMETHOD StartPrint(nsIPresContext* aPresContext,
|
||||
nsIPrintOptions* aPrintOptions) = 0;
|
||||
NS_IMETHOD PrintNextPage(nsIPresContext* aPresContext,
|
||||
nsIPrintOptions* aPrintOptions) = 0;
|
||||
NS_IMETHOD GetCurrentPageNum(PRInt32* aPageNum) = 0;
|
||||
NS_IMETHOD GetNumPages(PRInt32* aNumPages) = 0;
|
||||
NS_IMETHOD IsDoingPrintRange(PRBool* aDoing) = 0;
|
||||
NS_IMETHOD GetPrintRange(PRInt32* aFromPage, PRInt32* aToPage) = 0;
|
||||
|
||||
NS_IMETHOD SkipPageBegin() = 0;
|
||||
NS_IMETHOD SkipPageEnd() = 0;
|
||||
|
||||
NS_IMETHOD DoPageEnd(nsIPresContext* aPresContext) = 0;
|
||||
NS_IMETHOD GetPrintThisPage(PRBool* aPrintThisPage) = 0;
|
||||
NS_IMETHOD SetOffset(nscoord aX, nscoord aY) = 0;
|
||||
NS_IMETHOD SuppressHeadersAndFooters(PRBool aDoSup) = 0;
|
||||
NS_IMETHOD SetClipRect(nsIPresContext* aPresContext, nsRect* aSize) = 0;
|
||||
|
||||
private:
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
|
||||
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIPageSequenceFrame_h___ */
|
||||
|
||||
|
||||
540
mozilla/layout/base/public/nsIPresContext.h
Normal file
540
mozilla/layout/base/public/nsIPresContext.h
Normal file
@@ -0,0 +1,540 @@
|
||||
/* -*- 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):
|
||||
* IBM Corporation
|
||||
*
|
||||
* This Original Code has been modified by IBM Corporation.
|
||||
* Modifications made by IBM described herein are
|
||||
* Copyright (c) International Business Machines
|
||||
* Corporation, 2000
|
||||
*
|
||||
* Modifications to Mozilla code or documentation
|
||||
* identified per MPL Section 3.3
|
||||
*
|
||||
* Date Modified by Description of modification
|
||||
* 03/20/2000 IBM Corp. BiDi - ability to change the default direction of the browser
|
||||
*
|
||||
*/
|
||||
#ifndef nsIPresContext_h___
|
||||
#define nsIPresContext_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsIFrameImageLoader.h"
|
||||
#include "nsILanguageAtom.h"
|
||||
#ifdef IBMBIDI
|
||||
#include "nsIUBidiUtils.h"
|
||||
class nsAutoString;
|
||||
class nsBidiPresUtils;
|
||||
#endif // IBMBIDI
|
||||
|
||||
struct nsFont;
|
||||
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIDeviceContext;
|
||||
class nsIFontMetrics;
|
||||
class nsIFrame;
|
||||
class nsIImage;
|
||||
class nsIImageGroup;
|
||||
class nsILinkHandler;
|
||||
class nsIPresShell;
|
||||
class nsIPref;
|
||||
class nsIStyleContext;
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsIEventStateManager;
|
||||
class nsIURI;
|
||||
class nsILookAndFeel;
|
||||
class nsICSSPseudoComparator;
|
||||
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
class nsIRenderingContext;
|
||||
#endif
|
||||
|
||||
#define NS_IPRESCONTEXT_IID \
|
||||
{ 0x0a5d12e0, 0x944e, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
enum nsCompatibility {
|
||||
eCompatibility_Standard = 1,
|
||||
eCompatibility_NavQuirks = 2
|
||||
};
|
||||
|
||||
enum nsWidgetRendering {
|
||||
eWidgetRendering_Native = 1,
|
||||
eWidgetRendering_Gfx = 2,
|
||||
eWidgetRendering_PartialGfx = 3
|
||||
};
|
||||
|
||||
enum nsWidgetType {
|
||||
eWidgetType_Button = 1,
|
||||
eWidgetType_Checkbox = 2,
|
||||
eWidgetType_Radio = 3,
|
||||
eWidgetType_Text = 4
|
||||
};
|
||||
|
||||
enum nsLanguageSpecificTransformType {
|
||||
eLanguageSpecificTransformType_Unknown = -1,
|
||||
eLanguageSpecificTransformType_None = 0,
|
||||
eLanguageSpecificTransformType_Japanese,
|
||||
eLanguageSpecificTransformType_Korean
|
||||
};
|
||||
|
||||
// supported values for cached bool types
|
||||
const PRUint32 kPresContext_UseDocumentColors = 0x01;
|
||||
const PRUint32 kPresContext_UseDocumentFonts = 0x02;
|
||||
const PRUint32 kPresContext_UnderlineLinks = 0x03;
|
||||
|
||||
// An interface for presentation contexts. Presentation contexts are
|
||||
// objects that provide an outer context for a presentation shell.
|
||||
class nsIPresContext : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IPRESCONTEXT_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Initialize the presentation context from a particular device.
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDeviceContext* aDeviceContext) = 0;
|
||||
|
||||
/**
|
||||
* Stop the presentation in preperation for destruction.
|
||||
* @param aStopChrome PR_TRUE to stop chrome as well.
|
||||
*/
|
||||
NS_IMETHOD Stop(PRBool aStopChrome = PR_TRUE) = 0;
|
||||
|
||||
/**
|
||||
* Set the presentation shell that this context is bound to.
|
||||
* A presentation context may only be bound to a single shell.
|
||||
*/
|
||||
NS_IMETHOD SetShell(nsIPresShell* aShell) = 0;
|
||||
|
||||
/**
|
||||
* Get the PresentationShell that this context is bound to.
|
||||
*/
|
||||
NS_IMETHOD GetShell(nsIPresShell** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Access compatibility mode for this context
|
||||
*/
|
||||
NS_IMETHOD GetCompatibilityMode(nsCompatibility* aModeResult) = 0;
|
||||
NS_IMETHOD SetCompatibilityMode(nsCompatibility aMode) = 0;
|
||||
|
||||
/**
|
||||
* Access the widget rendering mode for this context
|
||||
*/
|
||||
NS_IMETHOD GetWidgetRenderingMode(nsWidgetRendering* aModeResult) = 0;
|
||||
NS_IMETHOD SetWidgetRenderingMode(nsWidgetRendering aMode) = 0;
|
||||
|
||||
/**
|
||||
* Access the image animation mode for this context
|
||||
*/
|
||||
NS_IMETHOD GetImageAnimationMode(nsImageAnimation* aModeResult) = 0;
|
||||
NS_IMETHOD SetImageAnimationMode(nsImageAnimation aMode) = 0;
|
||||
|
||||
/**
|
||||
* Get look and feel object
|
||||
*/
|
||||
NS_IMETHOD GetLookAndFeel(nsILookAndFeel** aLookAndFeel) = 0;
|
||||
|
||||
/**
|
||||
* Get base url for presentation
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURI** aURLResult) = 0;
|
||||
|
||||
/**
|
||||
* Get medium of presentation
|
||||
*/
|
||||
NS_IMETHOD GetMedium(nsIAtom** aMediumResult) = 0;
|
||||
|
||||
/**
|
||||
* Remap style from the root frame downwards, and reflow.
|
||||
*/
|
||||
NS_IMETHOD RemapStyleAndReflow(void) = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for the given piece of content that will be a child
|
||||
* of the aParentContext. Don't use this for pseudo frames.
|
||||
*/
|
||||
NS_IMETHOD ResolveStyleContextFor(nsIContent* aContent,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique,
|
||||
nsIStyleContext** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for a pseudo frame within the given aParentContent & aParentContext.
|
||||
* The tag should be lowercase and inclue the colon.
|
||||
* ie: NS_NewAtom(":first-line");
|
||||
*/
|
||||
NS_IMETHOD ResolvePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique,
|
||||
nsIStyleContext** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for a pseudo frame within the given aParentContent & aParentContext.
|
||||
* The tag should be lowercase and inclue the colon.
|
||||
* ie: NS_NewAtom(":first-line");
|
||||
*
|
||||
* Instead of matching solely on aPseudoTag, a comparator function can be
|
||||
* passed in to test.
|
||||
*/
|
||||
NS_IMETHOD ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique,
|
||||
nsICSSPseudoComparator* aComparator,
|
||||
nsIStyleContext** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Probe style for a pseudo frame within the given aParentContent & aParentContext.
|
||||
* This will return nsnull id there are no explicit rules for the pseudo element.
|
||||
* The tag should be lowercase and inclue the colon.
|
||||
* ie: NS_NewAtom(":first-line");
|
||||
*/
|
||||
NS_IMETHOD ProbePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique,
|
||||
nsIStyleContext** aResult) = 0;
|
||||
|
||||
/**
|
||||
* For a given frame tree, get a new style context that is the equivalent
|
||||
* but within a new parent
|
||||
*/
|
||||
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
|
||||
nsIStyleContext* aNewParentContext) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the font metrics for a given font.
|
||||
*/
|
||||
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult) = 0;
|
||||
|
||||
/** Get the default font */
|
||||
NS_IMETHOD GetDefaultFont(nsFont& aResult) = 0;
|
||||
/** Set the default font */
|
||||
NS_IMETHOD SetDefaultFont(const nsFont& aFont) = 0;
|
||||
virtual const nsFont& GetDefaultFontDeprecated() = 0;
|
||||
|
||||
/** Get the default fixed pitch font */
|
||||
NS_IMETHOD GetDefaultFixedFont(nsFont& aResult) = 0;
|
||||
/** Set the default fixed pitch font */
|
||||
NS_IMETHOD SetDefaultFixedFont(const nsFont& aFont) = 0;
|
||||
virtual const nsFont& GetDefaultFixedFontDeprecated() = 0;
|
||||
|
||||
/** Get a cached boolean pref, by its type
|
||||
if the type is not supported, then NS_ERROR_FAILURE is returned
|
||||
and the aValue argument is undfined, otherwise aValue is set
|
||||
to the value of the boolean pref */
|
||||
// * - initially created for bugs 31816, 20760, 22963
|
||||
NS_IMETHOD GetCachedBoolPref(PRUint32 prefType, PRBool &aValue) = 0;
|
||||
|
||||
/**
|
||||
* Access Nav's magic font scaler value
|
||||
*/
|
||||
NS_IMETHOD GetFontScaler(PRInt32* aResult) = 0;
|
||||
NS_IMETHOD SetFontScaler(PRInt32 aScaler) = 0;
|
||||
|
||||
/**
|
||||
* Get the default colors
|
||||
*/
|
||||
NS_IMETHOD GetDefaultColor(nscolor* aColor) = 0;
|
||||
NS_IMETHOD GetDefaultBackgroundColor(nscolor* aColor) = 0;
|
||||
NS_IMETHOD GetDefaultBackgroundImage(nsString& aImage) = 0;
|
||||
NS_IMETHOD GetDefaultBackgroundImageRepeat(PRUint8* aRepeat) = 0;
|
||||
NS_IMETHOD GetDefaultBackgroundImageOffset(nscoord* aX, nscoord* aY) = 0;
|
||||
NS_IMETHOD GetDefaultBackgroundImageAttachment(PRUint8* aRepeat) = 0;
|
||||
NS_IMETHOD GetDefaultLinkColor(nscolor* aColor) = 0;
|
||||
NS_IMETHOD GetDefaultVisitedLinkColor(nscolor* aColor) = 0;
|
||||
NS_IMETHOD GetFocusBackgroundColor(nscolor* aColor) = 0;
|
||||
NS_IMETHOD GetFocusTextColor(nscolor* aColor) = 0;
|
||||
NS_IMETHOD GetUseFocusColors(PRBool& useFocusColors) = 0;
|
||||
NS_IMETHOD GetFocusRingWidth(PRUint8 *focusRingWidth) = 0;
|
||||
NS_IMETHOD GetFocusRingOnAnything(PRBool& focusRingOnAnything) = 0;
|
||||
|
||||
|
||||
NS_IMETHOD SetDefaultColor(nscolor aColor) = 0;
|
||||
NS_IMETHOD SetDefaultBackgroundColor(nscolor aColor) = 0;
|
||||
NS_IMETHOD SetDefaultBackgroundImage(const nsString& aImage) = 0;
|
||||
NS_IMETHOD SetDefaultBackgroundImageRepeat(PRUint8 aRepeat) = 0;
|
||||
NS_IMETHOD SetDefaultBackgroundImageOffset(nscoord aX, nscoord aY) = 0;
|
||||
NS_IMETHOD SetDefaultBackgroundImageAttachment(PRUint8 aRepeat) = 0;
|
||||
NS_IMETHOD SetDefaultLinkColor(nscolor aColor) = 0;
|
||||
NS_IMETHOD SetDefaultVisitedLinkColor(nscolor aColor) = 0;
|
||||
|
||||
NS_IMETHOD GetImageGroup(nsIImageGroup** aGroupResult) = 0;
|
||||
|
||||
/**
|
||||
* Load an image for the target frame. This call can be made
|
||||
* repeated with only a single image ever being loaded. If
|
||||
* aNeedSizeUpdate is PR_TRUE, then when the image's size is
|
||||
* determined the target frame will be reflowed (via a
|
||||
* ContentChanged notification on the presentation shell). When the
|
||||
* image's data is ready for rendering the target frame's Paint()
|
||||
* method will be invoked (via the ViewManager) so that the
|
||||
* appropriate damage repair is done.
|
||||
*
|
||||
* @param aBackgroundColor - If the background color is NULL, a mask
|
||||
* will be generated for transparent images. If the background
|
||||
* color is non-NULL, it indicates the RGB value to be folded
|
||||
* into the transparent areas of the image and no mask is created.
|
||||
*/
|
||||
NS_IMETHOD StartLoadImage(const nsString& aURL,
|
||||
const nscolor* aBackgroundColor,
|
||||
const nsSize* aDesiredSize,
|
||||
nsIFrame* aTargetFrame,
|
||||
nsIFrameImageLoaderCB aCallBack,
|
||||
void* aClosure,
|
||||
void* aKey,
|
||||
nsIFrameImageLoader** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Stop a specific image load being done on behalf of the argument frame.
|
||||
*/
|
||||
NS_IMETHOD StopLoadImage(void* aKey,
|
||||
nsIFrameImageLoader* aLoader) = 0;
|
||||
|
||||
/**
|
||||
* Stop any image loading being done on behalf of the argument frame.
|
||||
*/
|
||||
NS_IMETHOD StopAllLoadImagesFor(nsIFrame* aTargetFrame, void* aKey) = 0;
|
||||
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer) = 0;
|
||||
|
||||
NS_IMETHOD GetContainer(nsISupports** aResult) = 0;
|
||||
|
||||
// XXX this are going to be replaced with set/get container
|
||||
NS_IMETHOD SetLinkHandler(nsILinkHandler* aHandler) = 0;
|
||||
NS_IMETHOD GetLinkHandler(nsILinkHandler** aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the visible area associated with this presentation context.
|
||||
* This is the size of the visiable area that is used for
|
||||
* presenting the document. The returned value is in the standard
|
||||
* nscoord units (as scaled by the device context).
|
||||
*/
|
||||
NS_IMETHOD GetVisibleArea(nsRect& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Set the currently visible area. The units for r are standard
|
||||
* nscoord units (as scaled by the device context).
|
||||
*/
|
||||
NS_IMETHOD SetVisibleArea(const nsRect& r) = 0;
|
||||
|
||||
/**
|
||||
* Return true if this presentation context is a paginated
|
||||
* context.
|
||||
*/
|
||||
NS_IMETHOD IsPaginated(PRBool* aResult) = 0;
|
||||
|
||||
/**
|
||||
* Gets the rect for the page Dimimensions,
|
||||
* this includes X,Y Offsets which are used to determine
|
||||
* the inclusion of margins
|
||||
* Also, indicates whether the size has been overridden
|
||||
*
|
||||
* @param aActualRect returns the size of the actual device/surface
|
||||
* @param aRect returns the adjusted size
|
||||
*/
|
||||
NS_IMETHOD GetPageDim(nsRect* aActualRect, nsRect* aAdjRect) = 0;
|
||||
|
||||
/**
|
||||
* Sets the "adjusted" rect for the page Dimimensions,
|
||||
* this includes X,Y Offsets which are used to determine
|
||||
* the inclusion of margins
|
||||
*
|
||||
* @param aRect returns the adjusted size
|
||||
*/
|
||||
NS_IMETHOD SetPageDim(nsRect* aRect) = 0;
|
||||
|
||||
NS_IMETHOD GetPixelsToTwips(float* aResult) const = 0;
|
||||
|
||||
NS_IMETHOD GetTwipsToPixels(float* aResult) const = 0;
|
||||
|
||||
//XXX this is probably not an ideal name. MMP
|
||||
/**
|
||||
* Do pixels to twips conversion taking into account
|
||||
* differing size of a "pixel" from device to device.
|
||||
*/
|
||||
NS_IMETHOD GetScaledPixelsToTwips(float* aScale) const = 0;
|
||||
|
||||
//be sure to Relase() after you are done with the Get()
|
||||
NS_IMETHOD GetDeviceContext(nsIDeviceContext** aResult) const = 0;
|
||||
|
||||
NS_IMETHOD GetEventStateManager(nsIEventStateManager** aManager) = 0;
|
||||
NS_IMETHOD GetDefaultDirection(PRUint8* aDirection) = 0;
|
||||
NS_IMETHOD SetDefaultDirection(PRUint8 aDirection) = 0;
|
||||
NS_IMETHOD GetLanguage(nsILanguageAtom** aLanguage) = 0;
|
||||
|
||||
/**
|
||||
* Get the language-specific transform type for the current document.
|
||||
* This tells us whether we need to perform special language-dependent
|
||||
* transformations such as Unicode U+005C (backslash) to Japanese
|
||||
* Yen Sign (Unicode U+00A5, JIS 0x5C).
|
||||
*
|
||||
* @param aType returns type, must be non-NULL
|
||||
*/
|
||||
NS_IMETHOD GetLanguageSpecificTransformType(
|
||||
nsLanguageSpecificTransformType* aType) = 0;
|
||||
|
||||
#ifdef IBMBIDI
|
||||
/**
|
||||
* Check if bidi enabled (set depending on the presence of RTL
|
||||
* characters or when default directionality is RTL).
|
||||
* If enabled, we should apply the Unicode Bidi Algorithm
|
||||
*
|
||||
* @lina 07/12/2000
|
||||
*/
|
||||
NS_IMETHOD BidiEnabled(PRBool& aBidiEnabled) const = 0;
|
||||
|
||||
/**
|
||||
* Set bidi enabled. This means we should apply the Unicode Bidi Algorithm
|
||||
*
|
||||
* @lina 07/12/2000
|
||||
*/
|
||||
NS_IMETHOD EnableBidi(void) const = 0;
|
||||
|
||||
/**
|
||||
* Set visual or implicit mode into the pres context.
|
||||
*
|
||||
* Visual directionality is a presentation method that displays text
|
||||
* as if it were a uni-directional, according to the primary display
|
||||
* direction only.
|
||||
*
|
||||
* Implicit directionality is a presentation method in which the
|
||||
* direction is determined by the Bidi algorithm according to the
|
||||
* category of the characters and the category of the adjacent
|
||||
* characters, and according to their primary direction.
|
||||
*
|
||||
* @lina 05/02/2000
|
||||
*/
|
||||
NS_IMETHOD SetVisualMode(PRBool aIsVisual) = 0;
|
||||
|
||||
/**
|
||||
* Check whether the content should be treated as visual.
|
||||
*
|
||||
* @lina 05/02/2000
|
||||
*/
|
||||
NS_IMETHOD IsVisualMode(PRBool& aIsVisual) const = 0;
|
||||
|
||||
//Mohamed
|
||||
|
||||
/**
|
||||
* Get a Bidi presentation utilities object
|
||||
*/
|
||||
NS_IMETHOD GetBidiUtils(nsBidiPresUtils** aBidiUtils) = 0;
|
||||
|
||||
/**
|
||||
* Set the Bidi options for the presentation context
|
||||
*/
|
||||
NS_IMETHOD SetBidi(PRUint32 aBidiOptions, PRBool aForceReflow = PR_FALSE) = 0;
|
||||
|
||||
/**
|
||||
* Get the Bidi options for the presentation context
|
||||
*/
|
||||
NS_IMETHOD GetBidi(PRUint32* aBidiOptions) = 0;
|
||||
//ahmed
|
||||
|
||||
/**
|
||||
* Check for Bidi text mode and direction
|
||||
* @return aResult == TRUE if the text mode is visual and the direction is right-to-left
|
||||
*/
|
||||
NS_IMETHOD IsVisRTL(PRBool &aResult) = 0;
|
||||
|
||||
/**
|
||||
* Check for Arabic encoding
|
||||
* @return aResult == TRUE if the document encoding is an Arabic codepage
|
||||
*/
|
||||
NS_IMETHOD IsArabicEncoding(PRBool &aResult) = 0;
|
||||
|
||||
/**
|
||||
* Set the Bidi capabilities of the system
|
||||
* @param aIsBidi == TRUE if the system has the capability of reordering Bidi text
|
||||
*/
|
||||
NS_IMETHOD SetIsBidiSystem(PRBool aIsBidi) = 0;
|
||||
|
||||
/**
|
||||
* Get the Bidi capabilities of the system
|
||||
* @return aResult == TRUE if the system has the capability of reordering Bidi text
|
||||
*/
|
||||
NS_IMETHOD GetIsBidiSystem(PRBool &aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Get the document charset
|
||||
*/
|
||||
NS_IMETHOD GetBidiCharset(nsAutoString &aCharSet) = 0;
|
||||
#endif // IBMBIDI
|
||||
|
||||
/**
|
||||
* Render only Selection
|
||||
*/
|
||||
NS_IMETHOD SetIsRenderingOnlySelection(PRBool aResult) = 0;
|
||||
NS_IMETHOD IsRenderingOnlySelection(PRBool* aResult) = 0;
|
||||
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType, nsIFrame * aFrame) = 0;
|
||||
NS_IMETHOD PaintCount(const char * aName, nsIRenderingContext* aRendingContext, nsIFrame * aFrame, PRUint32 aColor) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Bit values for StartLoadImage's aImageStatus
|
||||
#define NS_LOAD_IMAGE_STATUS_ERROR 0x1
|
||||
#define NS_LOAD_IMAGE_STATUS_SIZE 0x2
|
||||
#define NS_LOAD_IMAGE_STATUS_BITS 0x4
|
||||
|
||||
// Factory method to create a "galley" presentation context (galley is
|
||||
// a kind of view that has no limit to the size of a page)
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewGalleyContext(nsIPresContext** aInstancePtrResult);
|
||||
|
||||
// Factory method to create a "paginated" presentation context for
|
||||
// the screen.
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewPrintPreviewContext(nsIPresContext** aInstancePtrResult);
|
||||
|
||||
|
||||
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
|
||||
#define DO_GLOBAL_REFLOW_COUNT(_name, _type) \
|
||||
aPresContext->CountReflows((_name), (_type), (nsIFrame*)this);
|
||||
#else
|
||||
#define DO_GLOBAL_REFLOW_COUNT(_name, _type)
|
||||
#endif // MOZ_REFLOW_PERF
|
||||
|
||||
#if defined(MOZ_REFLOW_PERF_DSP) && defined(MOZ_REFLOW_PERF)
|
||||
#define DO_GLOBAL_REFLOW_COUNT_DSP(_name, _rend) \
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { \
|
||||
aPresContext->PaintCount((_name), (_rend), (nsIFrame*)this, 0); \
|
||||
}
|
||||
#define DO_GLOBAL_REFLOW_COUNT_DSP_J(_name, _rend, _just) \
|
||||
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { \
|
||||
aPresContext->PaintCount((_name), (_rend), (nsIFrame*)this, (_just)); \
|
||||
}
|
||||
#else
|
||||
#define DO_GLOBAL_REFLOW_COUNT_DSP(_name, _rend)
|
||||
#define DO_GLOBAL_REFLOW_COUNT_DSP_J(_name, _rend, _just)
|
||||
#endif // MOZ_REFLOW_PERF_DSP
|
||||
|
||||
#endif /* nsIPresContext_h___ */
|
||||
580
mozilla/layout/base/public/nsIPresShell.h
Normal file
580
mozilla/layout/base/public/nsIPresShell.h
Normal file
@@ -0,0 +1,580 @@
|
||||
/* -*- 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):
|
||||
* Steve Clark <buster@netscape.com>
|
||||
* Dan Rosen <dr@netscape.com>
|
||||
*
|
||||
* IBM Corporation
|
||||
*
|
||||
* This Original Code has been modified by IBM Corporation.
|
||||
* Modifications made by IBM described herein are
|
||||
* Copyright (c) International Business Machines
|
||||
* Corporation, 2000
|
||||
*
|
||||
* Modifications to Mozilla code or documentation
|
||||
* identified per MPL Section 3.3
|
||||
*
|
||||
* Date Modified by Description of modification
|
||||
* 05/03/2000 IBM Corp. Observer related defines for reflow
|
||||
*/
|
||||
#ifndef nsIPresShell_h___
|
||||
#define nsIPresShell_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsIReflowCommand.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
#include "nsISelectionController.h" //for the selection enums.
|
||||
|
||||
|
||||
class nsIContent;
|
||||
class nsIContentIterator;
|
||||
class nsIDocument;
|
||||
class nsIDocumentObserver;
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsIStyleSet;
|
||||
class nsIViewManager;
|
||||
class nsIDeviceContext;
|
||||
class nsIRenderingContext;
|
||||
class nsIPageSequenceFrame;
|
||||
class nsString;
|
||||
class nsStringArray;
|
||||
class nsICaret;
|
||||
class nsIStyleContext;
|
||||
class nsIFrameSelection;
|
||||
class nsIFrameManager;
|
||||
class nsILayoutHistoryState;
|
||||
class nsIArena;
|
||||
class nsIReflowCallback;
|
||||
class nsISupportsArray;
|
||||
|
||||
#define NS_IPRESSHELL_IID \
|
||||
{ 0x76e79c60, 0x944e, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
// Constants uses for ScrollFrameIntoView() function
|
||||
#define NS_PRESSHELL_SCROLL_TOP 0
|
||||
#define NS_PRESSHELL_SCROLL_BOTTOM 100
|
||||
#define NS_PRESSHELL_SCROLL_LEFT 0
|
||||
#define NS_PRESSHELL_SCROLL_RIGHT 100
|
||||
#define NS_PRESSHELL_SCROLL_CENTER 50
|
||||
#define NS_PRESSHELL_SCROLL_ANYWHERE -1
|
||||
#define NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE -2
|
||||
|
||||
// Observer related defines
|
||||
#define NS_PRESSHELL_REFLOW_TOPIC "REFLOW" // Observer Topic
|
||||
#define NS_PRESSHELL_INITIAL_REFLOW "INITIAL REFLOW" // Observer Data
|
||||
#define NS_PRESSHELL_RESIZE_REFLOW "RESIZE REFLOW" // Observer Data
|
||||
#define NS_PRESSHELL_STYLE_CHANGE_REFLOW "STYLE CHANGE REFLOW" // Observer Data
|
||||
|
||||
// debug VerifyReflow flags
|
||||
#define VERIFY_REFLOW_ON 0x01
|
||||
#define VERIFY_REFLOW_NOISY 0x02
|
||||
#define VERIFY_REFLOW_ALL 0x04
|
||||
#define VERIFY_REFLOW_DUMP_COMMANDS 0x08
|
||||
#define VERIFY_REFLOW_NOISY_RC 0x10
|
||||
#define VERIFY_REFLOW_REALLY_NOISY_RC 0x20
|
||||
#define VERIFY_REFLOW_INCLUDE_SPACE_MANAGER 0x40
|
||||
#define VERIFY_REFLOW_DURING_RESIZE_REFLOW 0x80
|
||||
|
||||
#ifdef IBMBIDI // Constant for Set/Get CursorBidiLevel
|
||||
#define BIDI_LEVEL_UNDEFINED 0x80
|
||||
#endif
|
||||
|
||||
// for PostAttributeChanged
|
||||
enum nsAttributeChangeType {
|
||||
eChangeType_Set = 0, // Set attribute
|
||||
eChangeType_Remove = 1 // Remove attribute
|
||||
};
|
||||
|
||||
/**
|
||||
* Presentation shell interface. Presentation shells are the
|
||||
* controlling point for managing the presentation of a document. The
|
||||
* presentation shell holds a live reference to the document, the
|
||||
* presentation context, the style manager, the style set and the root
|
||||
* frame. <p>
|
||||
*
|
||||
* When this object is Release'd, it will release the document, the
|
||||
* presentation context, the style manager, the style set and the root
|
||||
* frame.
|
||||
*/
|
||||
class nsIPresShell : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IPRESSHELL_IID; return iid; }
|
||||
|
||||
NS_IMETHOD Init(nsIDocument* aDocument,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet) = 0;
|
||||
|
||||
// All frames owned by the shell are allocated from an arena. They are also recycled
|
||||
// using free lists (separate free lists being maintained for each size_t).
|
||||
// Methods for recycling frames.
|
||||
NS_IMETHOD AllocateFrame(size_t aSize, void** aResult) = 0;
|
||||
NS_IMETHOD FreeFrame(size_t aSize, void* aFreeChunk) = 0;
|
||||
|
||||
// Dynamic stack memory allocation
|
||||
NS_IMETHOD PushStackMemory() = 0;
|
||||
NS_IMETHOD PopStackMemory() = 0;
|
||||
NS_IMETHOD AllocateStackMemory(size_t aSize, void** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetPresContext(nsIPresContext** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetViewManager(nsIViewManager** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetStyleSet(nsIStyleSet** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle) = 0;
|
||||
|
||||
NS_IMETHOD SelectAlternateStyleSheet(const nsString& aSheetTitle) = 0;
|
||||
|
||||
/** Setup all style rules required to implement preferences
|
||||
* - used for background/text/link colors and link underlining
|
||||
* may be extended for any prefs that are implemented via style rules
|
||||
* - aForceReflow argument is used to force a full reframe to make the rules show
|
||||
* (only used when the current page needs to reflect changed pref rules)
|
||||
*
|
||||
* - initially created for bugs 31816, 20760, 22963
|
||||
*/
|
||||
NS_IMETHOD SetPreferenceStyleRules(PRBool aForceReflow) = 0;
|
||||
|
||||
/** Allow client to enable and disable the use of the preference style rules,
|
||||
* by type.
|
||||
* NOTE: type argument is currently ignored, but is in the API for
|
||||
* future refinement
|
||||
*
|
||||
* - initially created for bugs 31816, 20760, 22963
|
||||
*/
|
||||
NS_IMETHOD EnablePrefStyleRules(PRBool aEnable, PRUint8 aPrefType=0xFF) = 0;
|
||||
NS_IMETHOD ArePrefStyleRulesEnabled(PRBool& aEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Gather titles of all selectable (alternate and preferred) style sheets
|
||||
* fills void array with nsString* caller must free strings
|
||||
*/
|
||||
NS_IMETHOD ListAlternateStyleSheets(nsStringArray& aTitleList) = 0;
|
||||
|
||||
/**
|
||||
* GetFrameSelection will return the Frame based selection API you
|
||||
* cannot go back and forth anymore with QI with nsIDOM sel and nsIFrame sel.
|
||||
*/
|
||||
NS_IMETHOD GetFrameSelection(nsIFrameSelection** aSelection) = 0;
|
||||
|
||||
// Make shell be a document observer
|
||||
NS_IMETHOD BeginObservingDocument() = 0;
|
||||
|
||||
// Make shell stop being a document observer
|
||||
NS_IMETHOD EndObservingDocument() = 0;
|
||||
|
||||
/**
|
||||
* Perform the initial reflow. Constructs the frame for the root content
|
||||
* object and then reflows the frame model into the specified width and
|
||||
* height.
|
||||
*
|
||||
* The coordinates for aWidth and aHeight must be in standard nscoord's.
|
||||
*/
|
||||
NS_IMETHOD InitialReflow(nscoord aWidth, nscoord aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Reflow the frame model into a new width and height. The
|
||||
* coordinates for aWidth and aHeight must be in standard nscoord's.
|
||||
*/
|
||||
NS_IMETHOD ResizeReflow(nscoord aWidth, nscoord aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Reflow the frame model with a reflow reason of eReflowReason_StyleChange
|
||||
*/
|
||||
NS_IMETHOD StyleChangeReflow() = 0;
|
||||
|
||||
NS_IMETHOD GetRootFrame(nsIFrame** aFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the page sequence frame associated with the frame hierarchy.
|
||||
* Returns NULL if not a paginated view.
|
||||
*/
|
||||
NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the primary frame associated with the content object. This is a
|
||||
* helper function that just forwards the request to the frame manager.
|
||||
*
|
||||
* The primary frame is the frame that is most closely associated with the
|
||||
* content. A frame is more closely associated with the content that another
|
||||
* frame if the one frame contains directly or indirectly the other frame (e.g.,
|
||||
* when a frame is scrolled there is a scroll frame that contains the frame
|
||||
* being scrolled). The primary frame is always the first-in-flow.
|
||||
*
|
||||
* In the case of absolutely positioned elements and floated elements,
|
||||
* the primary frame is the frame that is out of the flow and not the
|
||||
* placeholder frame.
|
||||
*/
|
||||
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent,
|
||||
nsIFrame** aPrimaryFrame) const = 0;
|
||||
|
||||
/** Returns the style context associated with the frame.
|
||||
* Used by code outside of layout that can't use nsIFrame methods to get
|
||||
* the style context directly.
|
||||
*/
|
||||
NS_IMETHOD GetStyleContextFor(nsIFrame* aFrame,
|
||||
nsIStyleContext** aStyleContext) const = 0;
|
||||
|
||||
/**
|
||||
* Returns a layout object associated with the primary frame for the content object.
|
||||
*
|
||||
* @param aContent the content object for which we seek a layout object
|
||||
* @param aResult the resulting layout object as an nsISupports, if found. Refcounted.
|
||||
*/
|
||||
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the object that acts as a subshell for aContent.
|
||||
* For example, for an html frame aResult will be an nsIDocShell.
|
||||
*/
|
||||
NS_IMETHOD GetSubShellFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Establish a relationship between aContent and aSubShell.
|
||||
* aSubShell will be returned from GetSubShellFor(aContent, ...);
|
||||
*/
|
||||
NS_IMETHOD SetSubShellFor(nsIContent* aContent,
|
||||
nsISupports* aSubShell) = 0;
|
||||
|
||||
/**
|
||||
* Gets the placeholder frame associated with the specified frame. This is
|
||||
* a helper frame that forwards the request to the frame manager.
|
||||
*/
|
||||
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
|
||||
nsIFrame** aPlaceholderFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Reflow commands
|
||||
*/
|
||||
NS_IMETHOD AppendReflowCommand(nsIReflowCommand* aReflowCommand) = 0;
|
||||
NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsIReflowCommand::ReflowType* aCmdType) = 0;
|
||||
NS_IMETHOD CancelAllReflowCommands() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Determine if it is safe to flush all pending notifications
|
||||
* @param aIsSafeToFlush PR_TRUE if it is safe, PR_FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush) = 0;
|
||||
|
||||
/**
|
||||
* Flush all pending notifications such that the presentation is
|
||||
* in sync with the content.
|
||||
*/
|
||||
NS_IMETHOD FlushPendingNotifications() = 0;
|
||||
|
||||
/**
|
||||
* Post a request to handle a DOM event after Reflow has finished.
|
||||
*/
|
||||
NS_IMETHOD PostDOMEvent(nsIContent* aContent, nsEvent* aEvent)=0;
|
||||
|
||||
/**
|
||||
* Post a request to set and attribute after reflow has finished.
|
||||
*/
|
||||
NS_IMETHOD PostAttributeChange(nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aName,
|
||||
const nsString& aValue,
|
||||
PRBool aNotify,
|
||||
nsAttributeChangeType aType) = 0;
|
||||
|
||||
NS_IMETHOD PostReflowCallback(nsIReflowCallback* aCallback) = 0;
|
||||
NS_IMETHOD CancelReflowCallback(nsIReflowCallback* aCallback) = 0;
|
||||
/**
|
||||
* Reflow batching
|
||||
*/
|
||||
NS_IMETHOD BeginReflowBatching() = 0;
|
||||
NS_IMETHOD EndReflowBatching(PRBool aFlushPendingReflows) = 0;
|
||||
NS_IMETHOD GetReflowBatchingStatus(PRBool* aIsBatching) = 0;
|
||||
|
||||
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Given a frame, create a rendering context suitable for use with
|
||||
* the frame.
|
||||
*/
|
||||
NS_IMETHOD CreateRenderingContext(nsIFrame *aFrame,
|
||||
nsIRenderingContext** aContext) = 0;
|
||||
|
||||
/**
|
||||
* Notification that we were unable to render a replaced element.
|
||||
* Called when the replaced element can not be rendered, and we should
|
||||
* instead render the element's contents.
|
||||
* The content object associated with aFrame should either be a IMG
|
||||
* element, an OBJECT element, or an APPLET element
|
||||
*/
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Scrolls the view of the document so that the anchor with the specified
|
||||
* name is displayed at the top of the window
|
||||
*/
|
||||
NS_IMETHOD GoToAnchor(const nsString& aAnchorName) = 0;
|
||||
|
||||
/**
|
||||
* Scrolls the view of the document so that the frame is displayed at the
|
||||
* top of the window.
|
||||
*
|
||||
* @param aFrame The frame to scroll into view
|
||||
* @param aVPercent How to align the frame vertically. A value of 0
|
||||
* (NS_PRESSHELL_SCROLL_TOP) means the frame's upper edge is
|
||||
* aligned with the top edge of the visible area. A value of
|
||||
* 100 (NS_PRESSHELL_SCROLL_BOTTOM) means the frame's bottom
|
||||
* edge is aligned with the bottom edge of the visible area.
|
||||
* For values in between, the point "aVPercent" down the frame
|
||||
* is placed at the point "aVPercent" down the visible area. A
|
||||
* value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
|
||||
* vertically. A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
|
||||
* the frame the minimum amount necessary in order for the entire
|
||||
* frame to be visible vertically (if possible)
|
||||
* @param aHPercent How to align the frame horizontally. A value of 0
|
||||
* (NS_PRESSHELL_SCROLL_LEFT) means the frame's left edge is
|
||||
* aligned with the left edge of the visible area. A value of
|
||||
* 100 (NS_PRESSHELL_SCROLL_RIGHT) means the frame's right
|
||||
* edge is aligned with the right edge of the visible area.
|
||||
* For values in between, the point "aVPercent" across the frame
|
||||
* is placed at the point "aVPercent" across the visible area.
|
||||
* A value of 50 (NS_PRESSHELL_SCROLL_CENTER) centers the frame
|
||||
* horizontally . A value of NS_PRESSHELL_SCROLL_ANYWHERE means move
|
||||
* the frame the minimum amount necessary in order for the entire
|
||||
* frame to be visible horizontally (if possible)
|
||||
*/
|
||||
NS_IMETHOD ScrollFrameIntoView(nsIFrame *aFrame,
|
||||
PRIntn aVPercent,
|
||||
PRIntn aHPercent) const = 0;
|
||||
|
||||
/**
|
||||
* Notification sent by a frame informing the pres shell that it is about to
|
||||
* be destroyed.
|
||||
* This allows any outstanding references to the frame to be cleaned up
|
||||
*/
|
||||
NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Returns the frame manager object
|
||||
*/
|
||||
NS_IMETHOD GetFrameManager(nsIFrameManager** aFrameManager) const = 0;
|
||||
|
||||
/**
|
||||
* Notify the Clipboard that we have something to copy.
|
||||
*/
|
||||
NS_IMETHOD DoCopy() = 0;
|
||||
|
||||
/**
|
||||
* Copy link location.
|
||||
*/
|
||||
NS_IMETHOD DoCopyLinkLocation(nsIDOMNode* aNode) = 0;
|
||||
|
||||
/**
|
||||
* Copy image methods.
|
||||
*/
|
||||
NS_IMETHOD DoCopyImageLocation(nsIDOMNode* aNode) = 0;
|
||||
NS_IMETHOD DoCopyImageContents(nsIDOMNode* aNode) = 0;
|
||||
|
||||
/**
|
||||
* Get the caret, if it exists. AddRefs it.
|
||||
*/
|
||||
NS_IMETHOD GetCaret(nsICaret **aOutCaret) = 0;
|
||||
|
||||
/**
|
||||
* Should the images have borders etc. Actual visual effects are determined
|
||||
* by the frames. Visual effects may not effect layout, only display.
|
||||
* Takes effect on next repaint, does not force a repaint itself.
|
||||
*
|
||||
* @param aEnabled if PR_TRUE, visual selection effects are enabled
|
||||
* if PR_FALSE visual selection effects are disabled
|
||||
* @return always NS_OK
|
||||
*/
|
||||
NS_IMETHOD SetDisplayNonTextSelection(PRBool aInEnable) = 0;
|
||||
|
||||
/**
|
||||
* Gets the current state of non text selection effects
|
||||
* @param aEnabled [OUT] set to the current state of non text selection,
|
||||
* as set by SetDisplayNonTextSelection
|
||||
* @return if aOutEnabled==null, returns NS_ERROR_INVALID_ARG
|
||||
* else NS_OK
|
||||
*/
|
||||
NS_IMETHOD GetDisplayNonTextSelection(PRBool *aOutEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Interface to dispatch events via the presshell
|
||||
*/
|
||||
NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent,
|
||||
nsIFrame* aFrame,
|
||||
nsIContent* aContent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aStatus) = 0;
|
||||
|
||||
/**
|
||||
* Dispatch event to content only (NOT full processing)
|
||||
*/
|
||||
NS_IMETHOD HandleDOMEventWithTarget(nsIContent* aTargetContent,
|
||||
nsEvent* aEvent,
|
||||
nsEventStatus* aStatus) = 0;
|
||||
|
||||
/**
|
||||
* Gets the current target event frame from the PresShell
|
||||
*/
|
||||
NS_IMETHOD GetEventTargetFrame(nsIFrame** aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Get and set the history state for the current document
|
||||
*/
|
||||
|
||||
NS_IMETHOD CaptureHistoryState(nsILayoutHistoryState** aLayoutHistoryState, PRBool aLeavingPage = PR_FALSE) = 0;
|
||||
NS_IMETHOD GetHistoryState(nsILayoutHistoryState** aLayoutHistoryState) = 0;
|
||||
NS_IMETHOD SetHistoryState(nsILayoutHistoryState* aLayoutHistoryState) = 0;
|
||||
|
||||
/**
|
||||
* Determine if reflow is currently locked
|
||||
* @param aIsReflowLocked returns PR_TRUE if reflow is locked, PR_FALSE otherwise
|
||||
*/
|
||||
NS_IMETHOD IsReflowLocked(PRBool* aIsLocked) = 0;
|
||||
|
||||
/**
|
||||
* Returns a content iterator to iterate the generated content nodes.
|
||||
* You must specify whether you want to iterate the "before" generated
|
||||
* content or the "after" generated content. If there is no generated
|
||||
* content of the specified type for the promary frame associated with
|
||||
* with the content object then NULL is returned
|
||||
*/
|
||||
enum GeneratedContentType {Before, After};
|
||||
NS_IMETHOD GetGeneratedContentIterator(nsIContent* aContent,
|
||||
GeneratedContentType aType,
|
||||
nsIContentIterator** aIterator) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Store the nsIAnonymousContentCreator-generated anonymous
|
||||
* content that's associated with an element.
|
||||
* @param aContent the element with which the anonymous
|
||||
* content is to be associated with
|
||||
* @param aAnonymousElements an array of nsIContent
|
||||
* objects, or null to indicate that any anonymous
|
||||
* content should be dissociated from the aContent
|
||||
*/
|
||||
NS_IMETHOD SetAnonymousContentFor(nsIContent* aContent, nsISupportsArray* aAnonymousElements) = 0;
|
||||
|
||||
/**
|
||||
* Retrieve the nsIAnonymousContentCreator-generated anonymous
|
||||
* content that's associated with an element.
|
||||
* @param aContent the element for which to retrieve the
|
||||
* associated anonymous content
|
||||
* @param aAnonymousElements an array of nsIContent objects,
|
||||
* or null to indicate that there are no anonymous elements
|
||||
* associated with aContent
|
||||
*/
|
||||
NS_IMETHOD GetAnonymousContentFor(nsIContent* aContent, nsISupportsArray** aAnonymousElements) = 0;
|
||||
|
||||
/**
|
||||
* Release all nsIAnonymousContentCreator-generated
|
||||
* anonymous content associated with the shell.
|
||||
*/
|
||||
NS_IMETHOD ReleaseAnonymousContent() = 0;
|
||||
|
||||
enum InterruptType {Timeout};
|
||||
/**
|
||||
* Notify aFrame via a reflow command when an aInterruptType event occurs
|
||||
*/
|
||||
NS_IMETHOD SendInterruptNotificationTo(nsIFrame* aFrame,
|
||||
InterruptType aInterruptType) = 0;
|
||||
/**
|
||||
* Cancel Notifications to aFrame when an aInterruptType event occurs
|
||||
*/
|
||||
NS_IMETHOD CancelInterruptNotificationTo(nsIFrame* aFrame,
|
||||
InterruptType aInterruptType) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* See if reflow verification is enabled. To enable reflow verification add
|
||||
* "verifyreflow:1" to your NSPR_LOG_MODULES environment variable
|
||||
* (any non-zero debug level will work). Or, call SetVerifyReflowEnable
|
||||
* with PR_TRUE.
|
||||
*/
|
||||
static NS_LAYOUT PRBool GetVerifyReflowEnable();
|
||||
|
||||
/**
|
||||
* Set the verify-reflow enable flag.
|
||||
*/
|
||||
static NS_LAYOUT void SetVerifyReflowEnable(PRBool aEnabled);
|
||||
|
||||
/**
|
||||
* Get the flags associated with the VerifyReflow debug tool
|
||||
*/
|
||||
static NS_LAYOUT PRInt32 GetVerifyReflowFlags();
|
||||
|
||||
|
||||
#ifdef MOZ_REFLOW_PERF
|
||||
NS_IMETHOD DumpReflows() = 0;
|
||||
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType, nsIFrame * aFrame) = 0;
|
||||
NS_IMETHOD PaintCount(const char * aName,
|
||||
nsIRenderingContext* aRenderingContext,
|
||||
nsIPresContext * aPresContext,
|
||||
nsIFrame * aFrame,
|
||||
PRUint32 aColor) = 0;
|
||||
NS_IMETHOD SetPaintFrameCount(PRBool aOn) = 0;
|
||||
#endif
|
||||
|
||||
#ifdef IBMBIDI
|
||||
/**
|
||||
* SetCursorBidiLevel will set the Bidi embedding level for the cursor. 0-63
|
||||
*/
|
||||
NS_IMETHOD SetCursorBidiLevel(PRUint8 aLevel) = 0;
|
||||
|
||||
/**
|
||||
* GetCursorBidiLevel will get the Bidi embedding level for the cursor. 0-63
|
||||
*/
|
||||
NS_IMETHOD GetCursorBidiLevel(PRUint8 *aOutLevel) = 0;
|
||||
|
||||
/**
|
||||
* UndefineCursorBidiLevel will set the Bidi embedding level for the cursor to an out-of-range value
|
||||
*/
|
||||
NS_IMETHOD UndefineCursorBidiLevel(void) = 0;
|
||||
|
||||
/**
|
||||
* Reconstruct and reflow frame model
|
||||
*/
|
||||
NS_IMETHOD BidiStyleChangeReflow(void) = 0;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a new empty presentation shell. Upon success, call Init
|
||||
* before attempting to use the shell.
|
||||
*/
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewPresShell(nsIPresShell** aInstancePtrResult);
|
||||
|
||||
#endif /* nsIPresShell_h___ */
|
||||
31
mozilla/layout/base/public/nsIPresState.h
Normal file
31
mozilla/layout/base/public/nsIPresState.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef _nsIPresState_h
|
||||
#define _nsIPresState_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {98DABCE1-C9D7-11d3-BF87-00105A1B0627}
|
||||
#define NS_IPRESSTATE_IID \
|
||||
{ 0x98dabce1, 0xc9d7, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
|
||||
|
||||
class nsIPresState : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRESSTATE_IID)
|
||||
|
||||
NS_IMETHOD GetStatePropertyAsSupports(const nsAReadableString& aName,
|
||||
nsISupports** aResult) = 0;
|
||||
NS_IMETHOD SetStatePropertyAsSupports(const nsAReadableString& aName,
|
||||
nsISupports* aValue) = 0;
|
||||
|
||||
NS_IMETHOD GetStateProperty(const nsAReadableString& aName,
|
||||
nsAWritableString& aResult) = 0;
|
||||
NS_IMETHOD SetStateProperty(const nsAReadableString& aProperty,
|
||||
const nsAReadableString& aValue) = 0;
|
||||
|
||||
NS_IMETHOD RemoveStateProperty(const nsAReadableString& aName) = 0;
|
||||
};
|
||||
|
||||
extern nsresult
|
||||
NS_NewPresState(nsIPresState** aResult);
|
||||
|
||||
#endif /* _nsIPresState_h */
|
||||
56
mozilla/layout/base/public/nsIPrintContext.h
Normal file
56
mozilla/layout/base/public/nsIPrintContext.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- 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):
|
||||
*
|
||||
* This Original Code has been modified by IBM Corporation.
|
||||
* Modifications made by IBM described herein are
|
||||
* Copyright (c) International Business Machines
|
||||
* Corporation, 2000
|
||||
*
|
||||
*/
|
||||
#ifndef nsIPrintContext_h___
|
||||
#define nsIPrintContext_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nscore.h"
|
||||
|
||||
|
||||
#define NS_IPRINTCONTEXT_IID \
|
||||
{ 0xa05e0e40, 0xe1bf, 0x11d4, \
|
||||
{ 0xa8, 0x5d, 0x0, 0x10, 0x5a, 0x18, 0x34, 0x19 } }
|
||||
|
||||
|
||||
// An interface for presentation printing contexts
|
||||
class nsIPrintContext : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRINTCONTEXT_IID)
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// Factory method to create a "paginated" presentation context for
|
||||
// printing
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewPrintContext(nsIPrintContext** aInstancePtrResult);
|
||||
|
||||
#endif
|
||||
34
mozilla/layout/base/public/nsIPrintListener.idl
Normal file
34
mozilla/layout/base/public/nsIPrintListener.idl
Normal file
@@ -0,0 +1,34 @@
|
||||
/* -*- 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) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(DB8D9F25-F183-11d3-8F9F-00A024A7D144)]
|
||||
|
||||
/* Use this for any object that wants to listen to print requests */
|
||||
|
||||
interface nsIPrintListener : nsISupports
|
||||
{
|
||||
void OnStartPrinting();
|
||||
void OnProgressPrinting(in PRUint32 aProgress, in PRUint32 aProgressMax);
|
||||
void OnEndPrinting(in PRUint32 aStatus);
|
||||
};
|
||||
43
mozilla/layout/base/public/nsIReflowCallback.h
Normal file
43
mozilla/layout/base/public/nsIReflowCallback.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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 Communicator client 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 Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIReflowCallback_h___
|
||||
#define nsIReflowCallback_h___
|
||||
|
||||
// {03E6FD70-889C-44b1-8639-A7EF5A80ED5C}
|
||||
#define NS_IREFLOWCALLBACK_IID \
|
||||
{ 0x3e6fd70, 0x889c, 0x44b1, { 0x86, 0x39, 0xa7, 0xef, 0x5a, 0x80, 0xed, 0x5c } }
|
||||
|
||||
class nsIPresShell;
|
||||
|
||||
/**
|
||||
* Reflow callback interface
|
||||
*/
|
||||
class nsIReflowCallback : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IREFLOWCALLBACK_IID; return iid; }
|
||||
|
||||
NS_IMETHOD ReflowFinished(nsIPresShell* aShell, PRBool* aFlushFlag) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIFrameUtil_h___ */
|
||||
179
mozilla/layout/base/public/nsIReflowCommand.h
Normal file
179
mozilla/layout/base/public/nsIReflowCommand.h
Normal file
@@ -0,0 +1,179 @@
|
||||
/* -*- 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 nsIReflowCommand_h___
|
||||
#define nsIReflowCommand_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include <stdio.h>
|
||||
|
||||
class nsIAtom;
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsIRenderingContext;
|
||||
struct nsHTMLReflowMetrics;
|
||||
struct nsSize;
|
||||
|
||||
// IID for the nsIReflowCommand interface {C3658E40-FF20-11d1-85BC-00A02468FAB6}
|
||||
#define NS_IREFLOWCOMMAND_IID \
|
||||
{ 0xc3658e40, 0xff20, 0x11d1, \
|
||||
{0x85, 0xbc, 0x0, 0xa0, 0x24, 0x68, 0xfa, 0xb6}}
|
||||
|
||||
// Reflow command flags
|
||||
#define NS_RC_CREATED_DURING_DOCUMENT_LOAD 0x0001
|
||||
|
||||
/**
|
||||
* A reflow command is an object that is generated in response to a content
|
||||
* model change notification. The reflow command is given to a presentation
|
||||
* shell where it is queued and then dispatched by invoking the reflow
|
||||
* commands's Dispatch() member function.
|
||||
*
|
||||
* Reflow command processing follows a path from the root frame down to the
|
||||
* target frame (the frame for which the reflow command is destined). Reflow
|
||||
* commands are processed by invoking the frame's Reflow() member function.
|
||||
*
|
||||
* The typical flow of control for a given reflow command starts with a content
|
||||
* change notification. The content notifications are sent to document observers.
|
||||
* The presentation shell forwards the notifications to the style set. The style
|
||||
* system responds to the notifications by creating new frame (or destroying
|
||||
* existing frames) as appropriate, and then generating a reflow command.
|
||||
*
|
||||
* @see nsIDocumentObserver
|
||||
* @see nsIStyleSet
|
||||
* @see nsIFrameReflow#Reflow()
|
||||
* @see nsIPresShell#AppendReflowCommand()
|
||||
* @see nsIPresShell#ProcessReflowCommands()
|
||||
*/
|
||||
class nsIReflowCommand : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IREFLOWCOMMAND_IID; return iid; }
|
||||
|
||||
enum ReflowType {
|
||||
// This reflow command is used when a leaf node's content changes
|
||||
// (e.g. some text in a text run, an image's source, etc.). The
|
||||
// target of the reflow command is the frame that changed (see
|
||||
// nsIFrame#ContentChanged() for how the target frame is
|
||||
// determined).
|
||||
ContentChanged,
|
||||
|
||||
// This reflow command is used when the style for a frame has
|
||||
// changed. This also implies that if the frame is a container
|
||||
// that its childrens style has also changed. The target of the
|
||||
// reflow command is the frame that changed style.
|
||||
StyleChanged,
|
||||
|
||||
// When an incremental reflow operation affects a next-in-flow,
|
||||
// these commands are used to get the next-in-flow to update
|
||||
// itself.
|
||||
PullupReflow,
|
||||
PushReflow,
|
||||
|
||||
// This command is used to see if a prev-in-flow wants to pullup
|
||||
// some children from a next-in-flow that has changed because of
|
||||
// an incremental reflow.
|
||||
CheckPullupReflow,
|
||||
|
||||
// Reflow dirty stuff (really a per-frame extension)
|
||||
ReflowDirty,
|
||||
|
||||
// The pres shell ran out of time but will guaranteed the reflow command gets processed.
|
||||
Timeout,
|
||||
|
||||
// Trap door for extensions.
|
||||
UserDefined
|
||||
};
|
||||
|
||||
/**
|
||||
* Dispatch the reflow command.
|
||||
*
|
||||
* Builds a path from the target frame back to the root frame, and then
|
||||
* invokes the root frame's Reflow() member function.
|
||||
*
|
||||
* @see nsIFrame#Reflow()
|
||||
*/
|
||||
NS_IMETHOD Dispatch(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsSize& aMaxSize,
|
||||
nsIRenderingContext& aRendContext) = 0;
|
||||
|
||||
/**
|
||||
* Get the next frame in the command processing path. If requested removes the
|
||||
* the frame from the path. You must remove the frame from the path before
|
||||
* dispatching the reflow command to the next frame in the chain.
|
||||
*/
|
||||
NS_IMETHOD GetNext(nsIFrame*& aNextFrame, PRBool aRemove = PR_TRUE) = 0;
|
||||
|
||||
/**
|
||||
* Get the target of the reflow command.
|
||||
*/
|
||||
NS_IMETHOD GetTarget(nsIFrame*& aTargetFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Change the target of the reflow command.
|
||||
*/
|
||||
NS_IMETHOD SetTarget(nsIFrame* aTargetFrame) = 0;
|
||||
|
||||
/**
|
||||
* Get the type of reflow command.
|
||||
*/
|
||||
NS_IMETHOD GetType(ReflowType& aReflowType) const = 0;
|
||||
|
||||
/**
|
||||
* Get the child frame associated with the reflow command.
|
||||
*/
|
||||
NS_IMETHOD GetChildFrame(nsIFrame*& aChildFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the name of the child list to which the child frame belongs.
|
||||
* Only used for reflow command types FrameAppended, FrameInserted, and
|
||||
* FrameRemoved
|
||||
*
|
||||
* Returns nsnull if the child frame is associated with the unnamed
|
||||
* principal child list
|
||||
*/
|
||||
NS_IMETHOD GetChildListName(nsIAtom*& aListName) const = 0;
|
||||
|
||||
/**
|
||||
* Sets the name of the child list to which the child frame belongs.
|
||||
* Only used for reflow command types FrameAppended, FrameInserted, and
|
||||
* FrameRemoved
|
||||
*/
|
||||
NS_IMETHOD SetChildListName(nsIAtom* aListName) = 0;
|
||||
|
||||
/**
|
||||
* Get the previous sibling frame associated with the reflow command.
|
||||
* This is used for FrameInserted reflow commands.
|
||||
*/
|
||||
NS_IMETHOD GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Dump out the reflow-command to out
|
||||
*/
|
||||
NS_IMETHOD List(FILE* out) const = 0;
|
||||
|
||||
/**
|
||||
* Get/set reflow command flags
|
||||
*/
|
||||
NS_IMETHOD GetFlags(PRInt32* aFlags) = 0;
|
||||
NS_IMETHOD SetFlags(PRInt32 aFlags) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIReflowCommand_h___ */
|
||||
124
mozilla/layout/base/public/nsIScrollableFrame.h
Normal file
124
mozilla/layout/base/public/nsIScrollableFrame.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/* -*- 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 nsIScrollFrame_h___
|
||||
#define nsIScrollFrame_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsIViewManager.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIBox;
|
||||
class nsIPresContext;
|
||||
|
||||
// IID for the nsIScrollableFrame interface
|
||||
#define NS_ISCROLLABLE_FRAME_IID \
|
||||
{ 0xc95f1831, 0xc372, 0x11d1, \
|
||||
{ 0xb7, 0x21, 0x0, 0x64, 0x9, 0x92, 0xd8, 0xc9 } }
|
||||
|
||||
class nsIScrollableFrame : public nsISupports {
|
||||
public:
|
||||
|
||||
enum nsScrollPref {
|
||||
Auto = 0,
|
||||
NeverScroll,
|
||||
AlwaysScroll,
|
||||
AlwaysScrollVertical,
|
||||
AlwaysScrollHorizontal
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCROLLABLE_FRAME_IID)
|
||||
|
||||
/**
|
||||
* Set the view that we are scrolling within the scrolling view.
|
||||
*/
|
||||
NS_IMETHOD SetScrolledFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame *aScrolledFrame) = 0;
|
||||
|
||||
/**
|
||||
* Get the view that we are scrolling within the scrollable frame.
|
||||
* @result child view
|
||||
*/
|
||||
NS_IMETHOD GetScrolledFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame *&aScrolledFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the size of the area that lies inside the scrollbars but clips the scrolled frame
|
||||
*/
|
||||
NS_IMETHOD GetClipSize(nsIPresContext* aPresContext,
|
||||
nscoord *aWidth,
|
||||
nscoord *aHeight) const = 0;
|
||||
/**
|
||||
* Get information about whether the vertical and horizontal scrollbars
|
||||
* are currently visible
|
||||
*/
|
||||
NS_IMETHOD GetScrollbarVisibility(nsIPresContext* aPresContext,
|
||||
PRBool *aVerticalVisible,
|
||||
PRBool *aHorizontalVisible) const = 0;
|
||||
|
||||
/**
|
||||
* Query whether scroll bars should be displayed all the time, never or
|
||||
* only when necessary.
|
||||
* @return current scrollbar selection
|
||||
*/
|
||||
NS_IMETHOD GetScrollPreference(nsIPresContext* aPresContext, nsScrollPref* aScrollPreference) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the size of the area that lies inside the scrollbars but clips the scrolled frame
|
||||
*/
|
||||
NS_IMETHOD GetScrollbarSizes(nsIPresContext* aPresContext,
|
||||
nscoord *aVbarWidth,
|
||||
nscoord *aHbarHeight) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the position of the scrolled view.
|
||||
*/
|
||||
NS_IMETHOD GetScrollPosition(nsIPresContext* aContext, nscoord &aX, nscoord& aY) const=0;
|
||||
|
||||
/**
|
||||
* Scroll the view to the given x,y, update's the scrollbar's thumb
|
||||
* positions and the view's offset. Clamps the values to be
|
||||
* legal. Updates the display based on aUpdateFlags.
|
||||
* @param aX left edge to scroll to
|
||||
* @param aY top edge to scroll to
|
||||
* @param aUpdateFlags passed onto nsIViewManager->UpdateView()
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD ScrollTo(nsIPresContext* aContext, nscoord aX, nscoord aY, PRUint32 aFlags = NS_VMREFRESH_NO_SYNC)=0;
|
||||
|
||||
NS_IMETHOD GetScrollableView(nsIPresContext* aContext, nsIScrollableView** aResult)=0;
|
||||
|
||||
|
||||
/**
|
||||
* Set information about whether the vertical and horizontal scrollbars
|
||||
* are currently visible
|
||||
*/
|
||||
NS_IMETHOD SetScrollbarVisibility(nsIPresContext* aPresContext,
|
||||
PRBool aVerticalVisible,
|
||||
PRBool aHorizontalVisible) = 0;
|
||||
|
||||
NS_IMETHOD GetScrollbarBox(PRBool aVertical, nsIBox** aResult) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
43
mozilla/layout/base/public/nsIScrollableViewProvider.h
Normal file
43
mozilla/layout/base/public/nsIScrollableViewProvider.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsIScrollableViewProvider_h
|
||||
#define _nsIScrollableViewProvider_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
#define NS_ISCROLLABLEVIEWPROVIDER_IID_STR "2b2e0d30-1dd2-11b2-9169-eb82b04f6775"
|
||||
|
||||
#define NS_ISCROLLABLEVIEWPROVIDER_IID \
|
||||
{0x2b2e0d30, 0x1dd2, 0x11b2, \
|
||||
{0x91, 0x69, 0xeb, 0x82, 0xb0, 0x4f, 0x67, 0x75}}
|
||||
|
||||
class nsIScrollableView;
|
||||
|
||||
class nsIScrollableViewProvider : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCROLLABLEVIEWPROVIDER_IID)
|
||||
|
||||
NS_IMETHOD GetScrollableView(nsIScrollableView** aView)=0;
|
||||
};
|
||||
|
||||
#endif /* _nsIScrollableViewProvider_h */
|
||||
254
mozilla/layout/base/public/nsISpaceManager.h
Normal file
254
mozilla/layout/base/public/nsISpaceManager.h
Normal file
@@ -0,0 +1,254 @@
|
||||
/* -*- 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 nsISpaceManager_h___
|
||||
#define nsISpaceManager_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsVoidArray;
|
||||
class nsISizeOfHandler;
|
||||
struct nsSize;
|
||||
|
||||
// IID for the nsISpaceManager interface {17C8FB50-BE96-11d1-80B5-00805F8A274D}
|
||||
#define NS_ISPACEMANAGER_IID \
|
||||
{ 0x17c8fb50, 0xbe96, 0x11d1, \
|
||||
{0x80, 0xb5, 0x0, 0x80, 0x5f, 0x8a, 0x27, 0x4d}}
|
||||
|
||||
/**
|
||||
* Information about a particular trapezoid within a band. The space described
|
||||
* by the trapezoid is in one of three states:
|
||||
* <ul>
|
||||
* <li>available
|
||||
* <li>occupied by one frame
|
||||
* <li>occupied by more than one frame
|
||||
* </ul>
|
||||
*/
|
||||
struct nsBandTrapezoid {
|
||||
enum State {Available, Occupied, OccupiedMultiple};
|
||||
|
||||
nscoord mTopY, mBottomY; // top and bottom y-coordinates
|
||||
nscoord mTopLeftX, mBottomLeftX; // left edge x-coordinates
|
||||
nscoord mTopRightX, mBottomRightX; // right edge x-coordinates
|
||||
State mState; // state of the space
|
||||
union {
|
||||
nsIFrame* mFrame; // single frame occupying the space
|
||||
const nsVoidArray* mFrames; // list of frames occupying the space
|
||||
};
|
||||
|
||||
// Get the height of the trapezoid
|
||||
nscoord GetHeight() const {return mBottomY - mTopY;}
|
||||
|
||||
// Get the bouding rect of the trapezoid
|
||||
void GetRect(nsRect& aRect) const;
|
||||
|
||||
// Set the trapezoid from a rectangle
|
||||
void operator=(const nsRect& aRect);
|
||||
|
||||
/** does a binary compare of this object with aTrap */
|
||||
PRBool Equals(const nsBandTrapezoid aTrap) const;
|
||||
|
||||
/** does a semantic compare only of geometric data in this object and aTrap */
|
||||
PRBool EqualGeometry(const nsBandTrapezoid aTrap) const;
|
||||
|
||||
nsBandTrapezoid() {
|
||||
mTopY = mBottomY = mTopLeftX = mBottomLeftX = mTopRightX = mBottomRightX = 0;
|
||||
mFrame = nsnull;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Structure used for describing the space within a band.
|
||||
* @see #GetBandData()
|
||||
*/
|
||||
struct nsBandData {
|
||||
PRInt32 mCount; // [out] actual number of trapezoids in the band data
|
||||
PRInt32 mSize; // [in] the size of the array (number of trapezoids)
|
||||
nsBandTrapezoid* mTrapezoids; // [out] array of length 'size'
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for dealing with bands of available space. The space manager defines a coordinate
|
||||
* space with an origin at (0, 0) that grows down and to the right.
|
||||
*
|
||||
* @see nsIRunaround
|
||||
*/
|
||||
class nsISpaceManager : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISPACEMANAGER_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Get the frame that's associated with the space manager. This frame created
|
||||
* the space manager, and the world coordinate space is relative to this frame.
|
||||
*
|
||||
* You can use QueryInterface() on this frame to get any additional interfaces
|
||||
*/
|
||||
NS_IMETHOD GetFrame(nsIFrame*& aFrame) const = 0;
|
||||
|
||||
/**
|
||||
* Translate the current origin by the specified (dx, dy). This creates a new
|
||||
* local coordinate space relative to the current coordinate space.
|
||||
*/
|
||||
NS_IMETHOD Translate(nscoord aDx, nscoord aDy) = 0;
|
||||
|
||||
/**
|
||||
* Returns the current translation from local coordinate space to world
|
||||
* coordinate space. This represents the accumulated calls to Translate().
|
||||
*/
|
||||
NS_IMETHOD GetTranslation(nscoord& aX, nscoord& aY) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the y-most of the bottommost band or 0 if there are no bands.
|
||||
*
|
||||
* @return NS_OK if there are bands and NS_ERROR_ABORT if there are
|
||||
* no bands
|
||||
*/
|
||||
NS_IMETHOD YMost(nscoord& aYMost) const = 0;
|
||||
|
||||
/**
|
||||
* Returns a band starting at the specified y-offset. The band data indicates
|
||||
* which parts of the band are available, and which parts are unavailable
|
||||
*
|
||||
* The band data that is returned is in the coordinate space of the local
|
||||
* coordinate system.
|
||||
*
|
||||
* The local coordinate space origin, the y-offset, and the max size describe
|
||||
* a rectangle that's used to clip the underlying band of available space, i.e.
|
||||
* {0, aYOffset, aMaxSize.width, aMaxSize.height} in the local coordinate space
|
||||
*
|
||||
* @param aYOffset the y-offset of where the band begins. The coordinate is
|
||||
* relative to the upper-left corner of the local coordinate space
|
||||
* @param aMaxSize the size to use to constrain the band data
|
||||
* @param aBandData [in,out] used to return the list of trapezoids that
|
||||
* describe the available space and the unavailable space
|
||||
* @return NS_OK if successful and NS_ERROR_FAILURE if the band data is not
|
||||
* not large enough. The 'count' member of the band data struct
|
||||
* indicates how large the array of trapezoids needs to be
|
||||
*/
|
||||
NS_IMETHOD GetBandData(nscoord aYOffset,
|
||||
const nsSize& aMaxSize,
|
||||
nsBandData& aBandData) const = 0;
|
||||
|
||||
/**
|
||||
* Add a rectangular region of unavailable space. The space is relative to
|
||||
* the local coordinate system.
|
||||
*
|
||||
* The region is tagged with a frame
|
||||
*
|
||||
* @param aFrame the frame used to identify the region. Must not be NULL
|
||||
* @param aUnavailableSpace the bounding rect of the unavailable space
|
||||
* @return NS_OK if successful
|
||||
* NS_ERROR_FAILURE if there is already a region tagged with aFrame
|
||||
*/
|
||||
NS_IMETHOD AddRectRegion(nsIFrame* aFrame,
|
||||
const nsRect& aUnavailableSpace) = 0;
|
||||
|
||||
/**
|
||||
* Resize the rectangular region associated with aFrame by the specified
|
||||
* deltas. The height change always applies to the bottom edge or the existing
|
||||
* rect. You specify whether the width change applies to the left or right edge
|
||||
*
|
||||
* Returns NS_OK if successful, NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
enum AffectedEdge {LeftEdge, RightEdge};
|
||||
NS_IMETHOD ResizeRectRegion(nsIFrame* aFrame,
|
||||
nscoord aDeltaWidth,
|
||||
nscoord aDeltaHeight,
|
||||
AffectedEdge aEdge = RightEdge) = 0;
|
||||
|
||||
/**
|
||||
* Offset the region associated with aFrame by the specified amount.
|
||||
*
|
||||
* Returns NS_OK if successful, NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
NS_IMETHOD OffsetRegion(nsIFrame* aFrame, nscoord dx, nscoord dy) = 0;
|
||||
|
||||
/**
|
||||
* Remove the region associated with aFrane.
|
||||
*
|
||||
* Returns NS_OK if successful and NS_ERROR_INVALID_ARG if there is no region
|
||||
* tagged with aFrame
|
||||
*/
|
||||
NS_IMETHOD RemoveRegion(nsIFrame* aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Clears the list of regions representing the unavailable space.
|
||||
*/
|
||||
NS_IMETHOD ClearRegions() = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* Dump the state of the spacemanager out to a file
|
||||
*/
|
||||
NS_IMETHOD List(FILE* out) = 0;
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
inline void nsBandTrapezoid::GetRect(nsRect& aRect) const
|
||||
{
|
||||
aRect.x = PR_MIN(mTopLeftX, mBottomLeftX);
|
||||
aRect.y = mTopY;
|
||||
aRect.width = PR_MAX(mTopRightX, mBottomRightX) - aRect.x;
|
||||
aRect.height = mBottomY - mTopY;
|
||||
}
|
||||
|
||||
inline void nsBandTrapezoid::operator=(const nsRect& aRect)
|
||||
{
|
||||
mTopLeftX = mBottomLeftX = aRect.x;
|
||||
mTopRightX = mBottomRightX = aRect.XMost();
|
||||
mTopY = aRect.y;
|
||||
mBottomY = aRect.YMost();
|
||||
}
|
||||
|
||||
inline PRBool nsBandTrapezoid::Equals(const nsBandTrapezoid aTrap) const
|
||||
{
|
||||
return (
|
||||
mTopLeftX == aTrap.mTopLeftX &&
|
||||
mBottomLeftX == aTrap.mBottomLeftX &&
|
||||
mTopRightX == aTrap.mTopRightX &&
|
||||
mBottomRightX == aTrap.mBottomRightX &&
|
||||
mTopY == aTrap.mTopY &&
|
||||
mBottomY == aTrap.mBottomY &&
|
||||
mState == aTrap.mState &&
|
||||
mFrame == aTrap.mFrame
|
||||
);
|
||||
}
|
||||
|
||||
inline PRBool nsBandTrapezoid::EqualGeometry(const nsBandTrapezoid aTrap) const
|
||||
{
|
||||
return (
|
||||
mTopLeftX == aTrap.mTopLeftX &&
|
||||
mBottomLeftX == aTrap.mBottomLeftX &&
|
||||
mTopRightX == aTrap.mTopRightX &&
|
||||
mBottomRightX == aTrap.mBottomRightX &&
|
||||
mTopY == aTrap.mTopY &&
|
||||
mBottomY == aTrap.mBottomY
|
||||
);
|
||||
}
|
||||
|
||||
#endif /* nsISpaceManager_h___ */
|
||||
38
mozilla/layout/base/public/nsIStatefulFrame.h
Normal file
38
mozilla/layout/base/public/nsIStatefulFrame.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef _nsIStatefulFrame_h
|
||||
#define _nsIStatefulFrame_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIPresContext;
|
||||
class nsIPresState;
|
||||
|
||||
#define NS_ISTATEFULFRAME_IID_STR "306c8ca0-5f0c-11d3-a9fb-000064657374"
|
||||
|
||||
#define NS_ISTATEFULFRAME_IID \
|
||||
{0x306c8ca0, 0x5f0c, 0x11d3, \
|
||||
{0xa9, 0xfb, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
|
||||
|
||||
class nsIStatefulFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTATEFULFRAME_IID)
|
||||
|
||||
// If you implement nsIStatefulFrame, add an entry to this enum and use it
|
||||
// in your GetStateType method to prevent collisions.
|
||||
enum StateType {eNoType=-1, eCheckboxType, eFileType, eRadioType, eSelectType,
|
||||
eTextType, eScrollType, eNumStateTypes};
|
||||
|
||||
// If you create a special type stateful frame (e.g. scroll) that needs
|
||||
// to be captured outside of the standard pass through the frames, you'll need
|
||||
// a special ID by which to refer to that type.
|
||||
//
|
||||
// There is space reserved between standard ID's and special ID's by the
|
||||
// offset NS_CONTENT_ID_COUNTER_BASE
|
||||
enum SpecialStateID {eNoID=0, eDocumentScrollState};
|
||||
|
||||
|
||||
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType) = 0;
|
||||
NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsIPresState** aState) = 0;
|
||||
NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsIPresState* aState) = 0;
|
||||
};
|
||||
|
||||
#endif /* _nsIStatefulFrame_h */
|
||||
940
mozilla/layout/base/public/nsIStyleContext.h
Normal file
940
mozilla/layout/base/public/nsIStyleContext.h
Normal file
@@ -0,0 +1,940 @@
|
||||
/* -*- 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 nsIStyleContext_h___
|
||||
#define nsIStyleContext_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsMargin.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsFont.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsStyleCoord.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIStyleSet.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsILanguageAtom.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
class nsISizeOfHandler;
|
||||
|
||||
class nsIFrame;
|
||||
class nsIPresContext;
|
||||
class nsISupportsArray;
|
||||
class nsIStyleContext;
|
||||
|
||||
|
||||
inline void CalcSidesFor(const nsIFrame* aFrame, const nsStyleSides& aSides,
|
||||
PRUint8 aSpacing,
|
||||
const nscoord* aEnumTable, PRInt32 aNumEnums,
|
||||
nsMargin& aResult);
|
||||
|
||||
|
||||
#define SHARE_STYLECONTEXTS
|
||||
|
||||
// The lifetime of these objects is managed by the nsIStyleContext.
|
||||
|
||||
struct nsStyleFont : public nsStyleStruct {
|
||||
nsStyleFont(void)
|
||||
: mFont(nsnull, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL, NS_FONT_DECORATION_NONE, 0),
|
||||
mFixedFont(nsnull, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL, NS_FONT_DECORATION_NONE, 0)
|
||||
{}
|
||||
~nsStyleFont(void) {};
|
||||
|
||||
nsFont mFont; // [inherited]
|
||||
nsFont mFixedFont; // [inherited]
|
||||
PRUint8 mFlags; // [inherited] See nsStyleConsts.h
|
||||
|
||||
protected:
|
||||
nsStyleFont(const nsFont& aVariableFont, const nsFont& aFixedFont);
|
||||
nsStyleFont(nsIPresContext* aPresContext);
|
||||
};
|
||||
|
||||
struct nsStyleColor : public nsStyleStruct {
|
||||
nsStyleColor(void) {}
|
||||
~nsStyleColor(void) {}
|
||||
|
||||
nscolor mColor; // [inherited]
|
||||
|
||||
PRUint8 mBackgroundAttachment; // [reset] See nsStyleConsts.h
|
||||
PRUint8 mBackgroundFlags; // [reset] See nsStyleConsts.h
|
||||
PRUint8 mBackgroundRepeat; // [reset] See nsStyleConsts.h
|
||||
|
||||
nscolor mBackgroundColor; // [reset]
|
||||
nscoord mBackgroundXPosition; // [reset]
|
||||
nscoord mBackgroundYPosition; // [reset]
|
||||
nsString mBackgroundImage; // [reset] absolute url string
|
||||
|
||||
PRUint8 mCursor; // [reset] See nsStyleConsts.h NS_STYLE_CURSOR_*
|
||||
nsString mCursorImage; // [reset] url string
|
||||
float mOpacity; // [inherited] percentage
|
||||
|
||||
PRBool BackgroundIsTransparent() const {return (mBackgroundFlags &
|
||||
(NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE)) ==
|
||||
(NS_STYLE_BG_COLOR_TRANSPARENT | NS_STYLE_BG_IMAGE_NONE);}
|
||||
};
|
||||
|
||||
|
||||
#define BORDER_COLOR_DEFINED 0x80
|
||||
#define BORDER_COLOR_SPECIAL 0x40
|
||||
#define BORDER_STYLE_MASK 0x3F
|
||||
|
||||
#define NS_SPACING_MARGIN 0
|
||||
#define NS_SPACING_PADDING 1
|
||||
#define NS_SPACING_BORDER 2
|
||||
|
||||
|
||||
struct nsStyleMargin: public nsStyleStruct {
|
||||
nsStyleMargin(void) {};
|
||||
~nsStyleMargin(void) {};
|
||||
|
||||
nsStyleSides mMargin; // [reset] length, percent, auto, inherit
|
||||
|
||||
PRBool GetMargin(nsMargin& aMargin) const
|
||||
{
|
||||
if (mHasCachedMargin) {
|
||||
aMargin = mCachedMargin;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// XXX this is a deprecated method
|
||||
void CalcMarginFor(const nsIFrame* aFrame, nsMargin& aMargin) const
|
||||
{
|
||||
if (mHasCachedMargin) {
|
||||
aMargin = mCachedMargin;
|
||||
} else {
|
||||
CalcSidesFor(aFrame, mMargin, NS_SPACING_MARGIN, nsnull, 0, aMargin);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
PRPackedBool mHasCachedMargin;
|
||||
nsMargin mCachedMargin;
|
||||
};
|
||||
|
||||
|
||||
struct nsStylePadding: public nsStyleStruct {
|
||||
nsStylePadding(void) {};
|
||||
~nsStylePadding(void) {};
|
||||
|
||||
nsStyleSides mPadding; // [reset] length, percent, inherit
|
||||
|
||||
PRBool GetPadding(nsMargin& aPadding) const
|
||||
{
|
||||
if (mHasCachedPadding) {
|
||||
aPadding = mCachedPadding;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// XXX this is a deprecated method
|
||||
void CalcPaddingFor(const nsIFrame* aFrame, nsMargin& aPadding) const
|
||||
{
|
||||
if (mHasCachedPadding) {
|
||||
aPadding = mCachedPadding;
|
||||
} else {
|
||||
CalcSidesFor(aFrame, mPadding, NS_SPACING_PADDING, nsnull, 0, aPadding);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
PRPackedBool mHasCachedPadding;
|
||||
nsMargin mCachedPadding;
|
||||
};
|
||||
|
||||
|
||||
struct nsStyleBorder: public nsStyleStruct {
|
||||
nsStyleBorder(void) {};
|
||||
~nsStyleBorder(void) {};
|
||||
|
||||
nsStyleSides mBorder; // [reset] length, enum (see nsStyleConsts.h)
|
||||
nsStyleSides mBorderRadius; // [reset] length, percent, inherit
|
||||
PRUint8 mFloatEdge; // [reset] see nsStyleConsts.h
|
||||
|
||||
PRBool GetBorder(nsMargin& aBorder) const
|
||||
{
|
||||
if (mHasCachedBorder) {
|
||||
aBorder = mCachedBorder;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRUint8 GetBorderStyle(PRUint8 aSide) const
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
return (mBorderStyle[aSide] & BORDER_STYLE_MASK);
|
||||
}
|
||||
|
||||
void SetBorderStyle(PRUint8 aSide, PRUint8 aStyle)
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
mBorderStyle[aSide] &= ~BORDER_STYLE_MASK;
|
||||
mBorderStyle[aSide] |= (aStyle & BORDER_STYLE_MASK);
|
||||
|
||||
}
|
||||
|
||||
// PR_FALSE means TRANSPARENT
|
||||
PRBool GetBorderColor(PRUint8 aSide, nscolor& aColor) const
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
if ((mBorderStyle[aSide] & BORDER_COLOR_SPECIAL) == 0) {
|
||||
aColor = mBorderColor[aSide];
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void SetBorderColor(PRUint8 aSide, nscolor aColor)
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
mBorderColor[aSide] = aColor;
|
||||
mBorderStyle[aSide] &= ~BORDER_COLOR_SPECIAL;
|
||||
mBorderStyle[aSide] |= BORDER_COLOR_DEFINED;
|
||||
}
|
||||
|
||||
void SetBorderTransparent(PRUint8 aSide)
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
mBorderStyle[aSide] |= (BORDER_COLOR_DEFINED | BORDER_COLOR_SPECIAL);
|
||||
}
|
||||
|
||||
void UnsetBorderColor(PRUint8 aSide)
|
||||
{
|
||||
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
|
||||
mBorderStyle[aSide] &= BORDER_STYLE_MASK;
|
||||
}
|
||||
|
||||
// XXX these are deprecated methods
|
||||
void CalcBorderFor(const nsIFrame* aFrame, nsMargin& aBorder) const
|
||||
{
|
||||
if (mHasCachedBorder) {
|
||||
aBorder = mCachedBorder;
|
||||
} else {
|
||||
CalcSidesFor(aFrame, mBorder, NS_SPACING_BORDER, mBorderWidths, 3, aBorder);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
PRPackedBool mHasCachedBorder;
|
||||
nsMargin mCachedBorder;
|
||||
|
||||
PRUint8 mBorderStyle[4]; // [reset] See nsStyleConsts.h
|
||||
nscolor mBorderColor[4]; // [reset]
|
||||
|
||||
// XXX remove with deprecated methods
|
||||
nscoord mBorderWidths[3];
|
||||
};
|
||||
|
||||
|
||||
struct nsStyleBorderPadding: public nsStyleStruct {
|
||||
nsStyleBorderPadding(void) { mHasCachedBorderPadding = PR_FALSE; };
|
||||
~nsStyleBorderPadding(void) {};
|
||||
|
||||
PRBool GetBorderPadding(nsMargin& aBorderPadding) const {
|
||||
if (mHasCachedBorderPadding) {
|
||||
aBorderPadding = mCachedBorderPadding;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void SetBorderPadding(nsMargin aBorderPadding) {
|
||||
mCachedBorderPadding = aBorderPadding;
|
||||
mHasCachedBorderPadding = PR_TRUE;
|
||||
}
|
||||
|
||||
protected:
|
||||
nsMargin mCachedBorderPadding;
|
||||
PRPackedBool mHasCachedBorderPadding;
|
||||
};
|
||||
|
||||
|
||||
struct nsStyleOutline: public nsStyleStruct {
|
||||
nsStyleOutline(void) {};
|
||||
~nsStyleOutline(void) {};
|
||||
|
||||
nsStyleSides mOutlineRadius; // [reset] length, percent, inherit
|
||||
// (top=topLeft, right=topRight, bottom=bottomRight, left=bottomLeft)
|
||||
|
||||
nsStyleCoord mOutlineWidth; // [reset] length, enum (see nsStyleConsts.h)
|
||||
|
||||
PRBool GetOutlineWidth(nscoord& aWidth) const
|
||||
{
|
||||
if (mHasCachedOutline) {
|
||||
aWidth = mCachedOutlineWidth;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRUint8 GetOutlineStyle(void) const
|
||||
{
|
||||
return (mOutlineStyle & BORDER_STYLE_MASK);
|
||||
}
|
||||
|
||||
void SetOutlineStyle(PRUint8 aStyle)
|
||||
{
|
||||
mOutlineStyle &= ~BORDER_STYLE_MASK;
|
||||
mOutlineStyle |= (aStyle & BORDER_STYLE_MASK);
|
||||
}
|
||||
|
||||
// PR_FALSE means INVERT
|
||||
PRBool GetOutlineColor(nscolor& aColor) const
|
||||
{
|
||||
if ((mOutlineStyle & BORDER_COLOR_SPECIAL) == 0) {
|
||||
aColor = mOutlineColor;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void SetOutlineColor(nscolor aColor)
|
||||
{
|
||||
mOutlineColor = aColor;
|
||||
mOutlineStyle &= ~BORDER_COLOR_SPECIAL;
|
||||
mOutlineStyle |= BORDER_COLOR_DEFINED;
|
||||
}
|
||||
|
||||
void SetOutlineInvert(void)
|
||||
{
|
||||
mOutlineStyle |= (BORDER_COLOR_DEFINED | BORDER_COLOR_SPECIAL);
|
||||
}
|
||||
|
||||
protected:
|
||||
PRPackedBool mHasCachedOutline;
|
||||
nscoord mCachedOutlineWidth;
|
||||
|
||||
PRUint8 mOutlineStyle; // [reset] See nsStyleConsts.h
|
||||
nscolor mOutlineColor; // [reset]
|
||||
|
||||
// XXX remove with deprecated methods
|
||||
nscoord mBorderWidths[3];
|
||||
};
|
||||
|
||||
|
||||
struct nsStyleList : public nsStyleStruct {
|
||||
nsStyleList(void);
|
||||
~nsStyleList(void);
|
||||
|
||||
PRUint8 mListStyleType; // [inherited] See nsStyleConsts.h
|
||||
PRUint8 mListStylePosition; // [inherited]
|
||||
nsString mListStyleImage; // [inherited] absolute url string
|
||||
};
|
||||
|
||||
struct nsStylePosition : public nsStyleStruct {
|
||||
nsStylePosition(void);
|
||||
~nsStylePosition(void);
|
||||
|
||||
PRUint8 mPosition; // [reset] see nsStyleConsts.h
|
||||
|
||||
nsStyleSides mOffset; // [reset]
|
||||
nsStyleCoord mWidth; // [reset] coord, percent, auto, inherit
|
||||
nsStyleCoord mMinWidth; // [reset] coord, percent, inherit
|
||||
nsStyleCoord mMaxWidth; // [reset] coord, percent, null, inherit
|
||||
nsStyleCoord mHeight; // [reset] coord, percent, auto, inherit
|
||||
nsStyleCoord mMinHeight; // [reset] coord, percent, inherit
|
||||
nsStyleCoord mMaxHeight; // [reset] coord, percent, null, inherit
|
||||
PRUint8 mBoxSizing; // [reset] see nsStyleConsts.h
|
||||
|
||||
nsStyleCoord mZIndex; // [reset]
|
||||
|
||||
PRBool IsAbsolutelyPositioned() const {return (NS_STYLE_POSITION_ABSOLUTE == mPosition) ||
|
||||
(NS_STYLE_POSITION_FIXED == mPosition);}
|
||||
|
||||
PRBool IsPositioned() const {return IsAbsolutelyPositioned() ||
|
||||
(NS_STYLE_POSITION_RELATIVE == mPosition);}
|
||||
};
|
||||
|
||||
struct nsStyleText : public nsStyleStruct {
|
||||
nsStyleText(void);
|
||||
~nsStyleText(void);
|
||||
|
||||
PRUint8 mTextAlign; // [inherited] see nsStyleConsts.h
|
||||
PRUint8 mTextDecoration; // [reset] see nsStyleConsts.h
|
||||
PRUint8 mTextTransform; // [inherited] see nsStyleConsts.h
|
||||
PRUint8 mWhiteSpace; // [inherited] see nsStyleConsts.h
|
||||
#ifdef IBMBIDI
|
||||
PRUint8 mUnicodeBidi; // [inherited] see nsStyleConsts.h
|
||||
#endif // IBMBIDI
|
||||
|
||||
nsStyleCoord mLetterSpacing; // [inherited]
|
||||
nsStyleCoord mLineHeight; // [inherited]
|
||||
nsStyleCoord mTextIndent; // [inherited]
|
||||
nsStyleCoord mWordSpacing; // [inherited]
|
||||
nsStyleCoord mVerticalAlign; // [reset] see nsStyleConsts.h for enums
|
||||
|
||||
PRBool WhiteSpaceIsSignificant() const {
|
||||
return mWhiteSpace == NS_STYLE_WHITESPACE_PRE;
|
||||
}
|
||||
};
|
||||
|
||||
struct nsStyleDisplay : public nsStyleStruct {
|
||||
nsStyleDisplay(void) {};
|
||||
~nsStyleDisplay(void) {};
|
||||
|
||||
PRUint8 mDirection; // [inherited] see nsStyleConsts.h NS_STYLE_DIRECTION_*
|
||||
#ifdef IBMBIDI
|
||||
PRUint8 mExplicitDirection ; // [reset] see nsStyleConsts.h NS_STYLE_DIRECTION_*
|
||||
#endif
|
||||
PRUint8 mDisplay; // [reset] see nsStyleConsts.h NS_STYLE_DISPLAY_*
|
||||
PRUint8 mFloats; // [reset] see nsStyleConsts.h NS_STYLE_FLOAT_*
|
||||
PRUint8 mBreakType; // [reset] see nsStyleConsts.h NS_STYLE_CLEAR_*
|
||||
PRPackedBool mBreakBefore; // [reset]
|
||||
PRPackedBool mBreakAfter; // [reset]
|
||||
PRUint8 mVisible; // [inherited]
|
||||
PRUint8 mOverflow; // [reset] see nsStyleConsts.h
|
||||
|
||||
PRUint8 mClipFlags; // [reset] see nsStyleConsts.h
|
||||
#if 0
|
||||
// XXX This is how it is defined in the CSS2 spec, but the errata
|
||||
// changed it to be consistent with the positioning draft and how
|
||||
// Nav and IE implement it
|
||||
nsMargin mClip; // [reset] offsets from respective edge
|
||||
#else
|
||||
nsRect mClip; // [reset] offsets from upper-left border edge
|
||||
#endif
|
||||
nsCOMPtr<nsILanguageAtom> mLanguage; // [inherited]
|
||||
|
||||
PRBool IsBlockLevel() const {return (NS_STYLE_DISPLAY_BLOCK == mDisplay) ||
|
||||
(NS_STYLE_DISPLAY_LIST_ITEM == mDisplay) ||
|
||||
(NS_STYLE_DISPLAY_TABLE == mDisplay);}
|
||||
|
||||
PRBool IsFloating() const {
|
||||
return NS_STYLE_FLOAT_NONE != mFloats;
|
||||
}
|
||||
|
||||
PRBool IsVisible() const {
|
||||
return (mVisible == NS_STYLE_VISIBILITY_VISIBLE);
|
||||
}
|
||||
|
||||
PRBool IsVisibleOrCollapsed() const {
|
||||
return ((mVisible == NS_STYLE_VISIBILITY_VISIBLE) ||
|
||||
(mVisible == NS_STYLE_VISIBILITY_COLLAPSE));
|
||||
}
|
||||
};
|
||||
|
||||
struct nsStyleTable: public nsStyleStruct {
|
||||
nsStyleTable(void);
|
||||
~nsStyleTable(void);
|
||||
|
||||
PRUint8 mLayoutStrategy;// [reset] see nsStyleConsts.h NS_STYLE_TABLE_LAYOUT_*
|
||||
PRUint8 mFrame; // [reset] see nsStyleConsts.h NS_STYLE_TABLE_FRAME_*
|
||||
PRUint8 mRules; // [reset] see nsStyleConsts.h NS_STYLE_TABLE_RULES_*
|
||||
PRUint8 mBorderCollapse;// [inherited]
|
||||
nsStyleCoord mBorderSpacingX;// [inherited]
|
||||
nsStyleCoord mBorderSpacingY;// [inherited]
|
||||
nsStyleCoord mCellPadding; // [reset]
|
||||
PRUint8 mCaptionSide; // [inherited]
|
||||
PRUint8 mEmptyCells; // [inherited]
|
||||
PRInt32 mCols; // [reset] an integer if set, or see nsStyleConsts.h NS_STYLE_TABLE_COLS_*
|
||||
PRInt32 mSpan; // [reset] the number of columns spanned by a colgroup or col
|
||||
nsStyleCoord mSpanWidth; // [reset] the amount of width this col gets from a spanning cell, if any
|
||||
};
|
||||
|
||||
enum nsStyleContentType {
|
||||
eStyleContentType_String = 1,
|
||||
eStyleContentType_URL = 10,
|
||||
eStyleContentType_Attr = 20,
|
||||
eStyleContentType_Counter = 30,
|
||||
eStyleContentType_Counters = 31,
|
||||
eStyleContentType_OpenQuote = 40,
|
||||
eStyleContentType_CloseQuote = 41,
|
||||
eStyleContentType_NoOpenQuote = 42,
|
||||
eStyleContentType_NoCloseQuote = 43
|
||||
};
|
||||
|
||||
struct nsStyleContentData {
|
||||
nsStyleContentType mType;
|
||||
nsString mContent;
|
||||
};
|
||||
|
||||
struct nsStyleCounterData {
|
||||
nsString mCounter;
|
||||
PRInt32 mValue;
|
||||
};
|
||||
|
||||
|
||||
#define DELETE_ARRAY_IF(array) if (array) { delete[] array; array = nsnull; }
|
||||
|
||||
struct nsStyleContent: public nsStyleStruct {
|
||||
nsStyleContent(void);
|
||||
~nsStyleContent(void);
|
||||
|
||||
PRUint32 ContentCount(void) const { return mContentCount; } // [reset]
|
||||
nsresult GetContentAt(PRUint32 aIndex, nsStyleContentType& aType, nsString& aContent) const {
|
||||
if (aIndex < mContentCount) {
|
||||
aType = mContents[aIndex].mType;
|
||||
aContent = mContents[aIndex].mContent;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
nsresult AllocateContents(PRUint32 aCount) {
|
||||
if (aCount != mContentCount) {
|
||||
DELETE_ARRAY_IF(mContents);
|
||||
if (aCount) {
|
||||
mContents = new nsStyleContentData[aCount];
|
||||
if (! mContents) {
|
||||
mContentCount = 0;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
mContentCount = aCount;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult SetContentAt(PRUint32 aIndex, nsStyleContentType aType, const nsString& aContent) {
|
||||
if (aIndex < mContentCount) {
|
||||
mContents[aIndex].mType = aType;
|
||||
if (aType < eStyleContentType_OpenQuote) {
|
||||
mContents[aIndex].mContent = aContent;
|
||||
}
|
||||
else {
|
||||
mContents[aIndex].mContent.Truncate();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
PRUint32 CounterIncrementCount(void) const { return mIncrementCount; } // [reset]
|
||||
nsresult GetCounterIncrementAt(PRUint32 aIndex, nsString& aCounter, PRInt32& aIncrement) const {
|
||||
if (aIndex < mIncrementCount) {
|
||||
aCounter = mIncrements[aIndex].mCounter;
|
||||
aIncrement = mIncrements[aIndex].mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
nsresult AllocateCounterIncrements(PRUint32 aCount) {
|
||||
if (aCount != mIncrementCount) {
|
||||
DELETE_ARRAY_IF(mIncrements);
|
||||
if (aCount) {
|
||||
mIncrements = new nsStyleCounterData[aCount];
|
||||
if (! mIncrements) {
|
||||
mIncrementCount = 0;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
mIncrementCount = aCount;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult SetCounterIncrementAt(PRUint32 aIndex, const nsString& aCounter, PRInt32 aIncrement) {
|
||||
if (aIndex < mIncrementCount) {
|
||||
mIncrements[aIndex].mCounter = aCounter;
|
||||
mIncrements[aIndex].mValue = aIncrement;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
PRUint32 CounterResetCount(void) const { return mResetCount; } // [reset]
|
||||
nsresult GetCounterResetAt(PRUint32 aIndex, nsString& aCounter, PRInt32& aValue) const {
|
||||
if (aIndex < mResetCount) {
|
||||
aCounter = mResets[aIndex].mCounter;
|
||||
aValue = mResets[aIndex].mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
nsresult AllocateCounterResets(PRUint32 aCount) {
|
||||
if (aCount != mResetCount) {
|
||||
DELETE_ARRAY_IF(mResets);
|
||||
if (aCount) {
|
||||
mResets = new nsStyleCounterData[aCount];
|
||||
if (! mResets) {
|
||||
mResetCount = 0;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
mResetCount = aCount;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult SetCounterResetAt(PRUint32 aIndex, const nsString& aCounter, PRInt32 aValue) {
|
||||
if (aIndex < mResetCount) {
|
||||
mResets[aIndex].mCounter = aCounter;
|
||||
mResets[aIndex].mValue = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
nsStyleCoord mMarkerOffset; // [reset]
|
||||
|
||||
PRUint32 QuotesCount(void) const { return mQuotesCount; } // [inherited]
|
||||
nsresult GetQuotesAt(PRUint32 aIndex, nsString& aOpen, nsString& aClose) const {
|
||||
if (aIndex < mQuotesCount) {
|
||||
aIndex *= 2;
|
||||
aOpen = mQuotes[aIndex];
|
||||
aClose = mQuotes[++aIndex];
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
nsresult AllocateQuotes(PRUint32 aCount) {
|
||||
if (aCount != mQuotesCount) {
|
||||
DELETE_ARRAY_IF(mQuotes);
|
||||
if (aCount) {
|
||||
mQuotes = new nsString[aCount * 2];
|
||||
if (! mQuotes) {
|
||||
mQuotesCount = 0;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
mQuotesCount = aCount;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult SetQuotesAt(PRUint32 aIndex, const nsString& aOpen, const nsString& aClose) {
|
||||
if (aIndex < mQuotesCount) {
|
||||
aIndex *= 2;
|
||||
mQuotes[aIndex] = aOpen;
|
||||
mQuotes[++aIndex] = aClose;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
protected:
|
||||
PRUint32 mContentCount;
|
||||
nsStyleContentData* mContents;
|
||||
|
||||
PRUint32 mIncrementCount;
|
||||
nsStyleCounterData* mIncrements;
|
||||
|
||||
PRUint32 mResetCount;
|
||||
nsStyleCounterData* mResets;
|
||||
|
||||
PRUint32 mQuotesCount;
|
||||
nsString* mQuotes;
|
||||
};
|
||||
|
||||
struct nsStyleUserInterface: public nsStyleStruct {
|
||||
nsStyleUserInterface(void);
|
||||
~nsStyleUserInterface(void);
|
||||
|
||||
PRUint8 mUserInput; // [inherited]
|
||||
PRUint8 mUserModify; // [inherited] (modify-content)
|
||||
PRUint8 mUserSelect; // [reset] (selection-style)
|
||||
PRUint8 mUserFocus; // [inherited] (auto-select)
|
||||
PRUnichar mKeyEquivalent; // [reset] XXX what type should this be?
|
||||
PRUint8 mResizer; // [reset]
|
||||
nsString mBehavior; // [reset] absolute url string
|
||||
|
||||
};
|
||||
|
||||
struct nsStylePrint: public nsStyleStruct {
|
||||
nsStylePrint(void);
|
||||
~nsStylePrint(void);
|
||||
|
||||
PRUint8 mPageBreakBefore; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_BREAK_*
|
||||
PRUint8 mPageBreakAfter; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_BREAK_*
|
||||
PRUint8 mPageBreakInside; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_BREAK_*
|
||||
nsString mPage;
|
||||
PRUint32 mWidows; // [reset] = 2, number of isolated lines at the top of a page
|
||||
PRUint32 mOrphans; // [reset] = 2, number of isolated lines at the bottom of a page
|
||||
PRUint8 mMarks; // [reset] see nsStyleConsts.h NS_STYLE_PAGE_MARKS_*
|
||||
nsStyleCoord mSizeWidth; // [reset] length, enum: see nsStyleConsts.h NS_STYLE_PAGE_SIZE_*
|
||||
nsStyleCoord mSizeHeight; // [reset] length, enum: see nsStyleConsts.h NS_STYLE_PAGE_SIZE_*
|
||||
};
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
struct nsStyleXUL : public nsStyleStruct {
|
||||
nsStyleXUL();
|
||||
~nsStyleXUL();
|
||||
|
||||
// There will be seven more properties coming,
|
||||
// which is why we warrant our own struct.
|
||||
// box-align, box-direction, box-flex, box-flex-group, box-pack,
|
||||
// stack-stretch, stack-policy
|
||||
PRUint8 mBoxOrient; // [reset] see nsStyleConsts.h
|
||||
};
|
||||
#endif
|
||||
|
||||
#define BORDER_PRECEDENT_EQUAL 0
|
||||
#define BORDER_PRECEDENT_LOWER 1
|
||||
#define BORDER_PRECEDENT_HIGHER 2
|
||||
|
||||
struct nsBorderEdges;
|
||||
|
||||
/** an encapsulation of border edge info */
|
||||
struct nsBorderEdge
|
||||
{
|
||||
/** the thickness of the edge */
|
||||
nscoord mWidth;
|
||||
/** the length of the edge */
|
||||
nscoord mLength;
|
||||
PRUint8 mStyle;
|
||||
nscolor mColor;
|
||||
/** which side does this edge represent? */
|
||||
PRUint8 mSide;
|
||||
/** if this edge is an outside edge, the border infor for the adjacent inside object */
|
||||
nsBorderEdges * mInsideNeighbor;
|
||||
|
||||
nsBorderEdge();
|
||||
};
|
||||
|
||||
inline nsBorderEdge::nsBorderEdge()
|
||||
{
|
||||
mWidth=0;
|
||||
mLength=0;
|
||||
mStyle=NS_STYLE_BORDER_STYLE_NONE;
|
||||
mColor=0;
|
||||
mSide=NS_SIDE_LEFT;
|
||||
mInsideNeighbor = nsnull;
|
||||
};
|
||||
|
||||
/** an encapsulation of a border defined by its edges
|
||||
* owner of this struct is responsible for freeing any data stored in mEdges
|
||||
*/
|
||||
struct nsBorderEdges
|
||||
{
|
||||
nsVoidArray mEdges[4];
|
||||
nsMargin mMaxBorderWidth;
|
||||
PRPackedBool mOutsideEdge;
|
||||
|
||||
nsBorderEdges();
|
||||
};
|
||||
|
||||
inline nsBorderEdges::nsBorderEdges()
|
||||
{
|
||||
mMaxBorderWidth.SizeTo(0,0,0,0);
|
||||
mOutsideEdge = PR_TRUE;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#define NS_ISTYLECONTEXT_IID \
|
||||
{ 0x26a4d970, 0xa342, 0x11d1, \
|
||||
{0x89, 0x74, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
|
||||
|
||||
class nsIStyleContext : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLECONTEXT_IID; return iid; }
|
||||
|
||||
virtual PRBool Equals(const nsIStyleContext* aOther) const = 0;
|
||||
virtual PRUint32 HashValue(void) const = 0;
|
||||
|
||||
virtual nsIStyleContext* GetParent(void) const = 0;
|
||||
virtual nsISupportsArray* GetStyleRules(void) const = 0;
|
||||
virtual PRInt32 GetStyleRuleCount(void) const = 0;
|
||||
NS_IMETHOD GetPseudoType(nsIAtom*& aPseudoTag) const = 0;
|
||||
|
||||
NS_IMETHOD FindChildWithRules(const nsIAtom* aPseudoTag,
|
||||
nsISupportsArray* aRules,
|
||||
nsIStyleContext*& aResult) = 0;
|
||||
|
||||
// Fill a style struct with data
|
||||
NS_IMETHOD GetStyle(nsStyleStructID aSID, nsStyleStruct& aStruct) const = 0;
|
||||
|
||||
// compute the effective difference between two contexts
|
||||
NS_IMETHOD CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint, PRBool aStopAtFirst = PR_FALSE) const = 0;
|
||||
|
||||
// debugging
|
||||
virtual void List(FILE* out, PRInt32 aIndent) = 0;
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize) = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual void DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) = 0;
|
||||
#endif
|
||||
|
||||
#ifdef SHARE_STYLECONTEXTS
|
||||
// sets aMatches to PR_TRUE if the style data of aStyleContextToMatch matches the
|
||||
// style data of this, PR_FALSE otherwise
|
||||
NS_IMETHOD StyleDataMatches(nsIStyleContext* aStyleContextToMatch, PRBool *aMatches) = 0;
|
||||
NS_IMETHOD GetStyleContextKey(scKey &aKey) const = 0;
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// DEPRECATED METHODS - these are all going away, stop using them
|
||||
// get a style data struct by ID, may return null
|
||||
// Replace calls to this with calls to GetStyle();
|
||||
virtual const nsStyleStruct* GetStyleData(nsStyleStructID aSID) = 0;
|
||||
|
||||
// get a style data struct by ID, may return null
|
||||
virtual nsStyleStruct* GetMutableStyleData(nsStyleStructID aSID) = 0;
|
||||
|
||||
// call this to prevent context from getting shared
|
||||
virtual void ForceUnique(void) = 0;
|
||||
|
||||
NS_IMETHOD RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse = PR_TRUE) = 0;
|
||||
|
||||
// call if you change style data after creation
|
||||
virtual void RecalcAutomaticData(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
// utility function: more convenient than 2 calls to GetStyleData to get border and padding
|
||||
virtual void CalcBorderPaddingFor(const nsIFrame* aFrame, nsMargin& aBorderPadding) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// XXX this is here to support deprecated calc spacing methods only
|
||||
inline nscoord CalcSideFor(const nsIFrame* aFrame, const nsStyleCoord& aCoord,
|
||||
PRUint8 aSpacing, PRUint8 aSide,
|
||||
const nscoord* aEnumTable, PRInt32 aNumEnums)
|
||||
{
|
||||
nscoord result = 0;
|
||||
|
||||
switch (aCoord.GetUnit()) {
|
||||
case eStyleUnit_Auto:
|
||||
// Auto margins are handled by layout
|
||||
break;
|
||||
|
||||
case eStyleUnit_Inherit:
|
||||
nsIFrame* parentFrame;
|
||||
aFrame->GetParent(&parentFrame); // XXX may not be direct parent...
|
||||
if (nsnull != parentFrame) {
|
||||
nsIStyleContext* parentContext;
|
||||
parentFrame->GetStyleContext(&parentContext);
|
||||
if (nsnull != parentContext) {
|
||||
nsMargin parentSpacing;
|
||||
switch (aSpacing) {
|
||||
case NS_SPACING_MARGIN:
|
||||
{
|
||||
const nsStyleMargin* parentMargin = (const nsStyleMargin*)parentContext->GetStyleData(eStyleStruct_Margin);
|
||||
parentMargin->CalcMarginFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
case NS_SPACING_PADDING:
|
||||
{
|
||||
const nsStylePadding* parentPadding = (const nsStylePadding*)parentContext->GetStyleData(eStyleStruct_Padding);
|
||||
parentPadding->CalcPaddingFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
case NS_SPACING_BORDER:
|
||||
{
|
||||
const nsStyleBorder* parentBorder = (const nsStyleBorder*)parentContext->GetStyleData(eStyleStruct_Border);
|
||||
parentBorder->CalcBorderFor(parentFrame, parentSpacing);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
switch (aSide) {
|
||||
case NS_SIDE_LEFT: result = parentSpacing.left; break;
|
||||
case NS_SIDE_TOP: result = parentSpacing.top; break;
|
||||
case NS_SIDE_RIGHT: result = parentSpacing.right; break;
|
||||
case NS_SIDE_BOTTOM: result = parentSpacing.bottom; break;
|
||||
}
|
||||
NS_RELEASE(parentContext);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case eStyleUnit_Percent:
|
||||
{
|
||||
nscoord baseWidth = 0;
|
||||
PRBool isBase = PR_FALSE;
|
||||
nsIFrame* frame;
|
||||
aFrame->GetParent(&frame);
|
||||
while (nsnull != frame) {
|
||||
frame->IsPercentageBase(isBase);
|
||||
if (isBase) {
|
||||
nsSize size;
|
||||
frame->GetSize(size);
|
||||
baseWidth = size.width; // not really width, need to subtract out padding...
|
||||
break;
|
||||
}
|
||||
frame->GetParent(&frame);
|
||||
}
|
||||
result = (nscoord)((float)baseWidth * aCoord.GetPercentValue());
|
||||
}
|
||||
break;
|
||||
|
||||
case eStyleUnit_Coord:
|
||||
result = aCoord.GetCoordValue();
|
||||
break;
|
||||
|
||||
case eStyleUnit_Enumerated:
|
||||
if (nsnull != aEnumTable) {
|
||||
PRInt32 value = aCoord.GetIntValue();
|
||||
if ((0 <= value) && (value < aNumEnums)) {
|
||||
return aEnumTable[aCoord.GetIntValue()];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case eStyleUnit_Null:
|
||||
case eStyleUnit_Normal:
|
||||
case eStyleUnit_Integer:
|
||||
case eStyleUnit_Proportional:
|
||||
default:
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
if ((NS_SPACING_PADDING == aSpacing) || (NS_SPACING_BORDER == aSpacing)) {
|
||||
if (result < 0) {
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void CalcSidesFor(const nsIFrame* aFrame, const nsStyleSides& aSides,
|
||||
PRUint8 aSpacing,
|
||||
const nscoord* aEnumTable, PRInt32 aNumEnums,
|
||||
nsMargin& aResult)
|
||||
{
|
||||
nsStyleCoord coord;
|
||||
|
||||
aResult.left = CalcSideFor(aFrame, aSides.GetLeft(coord), aSpacing, NS_SIDE_LEFT,
|
||||
aEnumTable, aNumEnums);
|
||||
aResult.top = CalcSideFor(aFrame, aSides.GetTop(coord), aSpacing, NS_SIDE_TOP,
|
||||
aEnumTable, aNumEnums);
|
||||
aResult.right = CalcSideFor(aFrame, aSides.GetRight(coord), aSpacing, NS_SIDE_RIGHT,
|
||||
aEnumTable, aNumEnums);
|
||||
aResult.bottom = CalcSideFor(aFrame, aSides.GetBottom(coord), aSpacing, NS_SIDE_BOTTOM,
|
||||
aEnumTable, aNumEnums);
|
||||
}
|
||||
|
||||
|
||||
// this is private to nsStyleSet, don't call it
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewStyleContext(nsIStyleContext** aInstancePtrResult,
|
||||
nsIStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoType,
|
||||
nsISupportsArray* aRules,
|
||||
nsIPresContext* aPresContext);
|
||||
|
||||
|
||||
#endif /* nsIStyleContext_h___ */
|
||||
328
mozilla/layout/base/public/nsIStyleFrameConstruction.h
Normal file
328
mozilla/layout/base/public/nsIStyleFrameConstruction.h
Normal file
@@ -0,0 +1,328 @@
|
||||
/* -*- 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 nsIStyleFrameConstruction_h___
|
||||
#define nsIStyleFrameConstruction_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIStyleSet.h"
|
||||
|
||||
class nsIPresShell;
|
||||
class nsIPresContext;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIAtom;
|
||||
class nsIStyleSheet;
|
||||
class nsIStyleRule;
|
||||
class nsStyleChangeList;
|
||||
class nsIFrameManager;
|
||||
class nsILayoutHistoryState;
|
||||
|
||||
// IID for the nsIStyleSet interface {a6cf9066-15b3-11d2-932e-00805f8add32}
|
||||
#define NS_ISTYLE_FRAME_CONSTRUCTION_IID \
|
||||
{0xa6cf9066, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/** Interface for objects that handle frame construction based on style.
|
||||
* All frame construction goes through an object that implements this interface.
|
||||
* Frames are built based on the state of the content model and the style model.
|
||||
* Changes to either content or style can cause changes to the frame model.
|
||||
*/
|
||||
class nsIStyleFrameConstruction : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLE_FRAME_CONSTRUCTION_IID)
|
||||
|
||||
/**
|
||||
* Create frames for the root content element and its child content.
|
||||
*
|
||||
* @param aPresShell the presentation shell for which we will consturct a root frame
|
||||
* @param aPresContext the presentation context
|
||||
* @param aDocElement the content node to map into a root frame
|
||||
* @param aFrameSubTree [OUT] the resulting frame tree (a root frame and its children)
|
||||
*
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD ConstructRootFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIContent* aDocElement,
|
||||
nsIFrame*& aFrameSubTree) = 0;
|
||||
|
||||
/**
|
||||
* Causes reconstruction of a frame hierarchy rooted by the
|
||||
* document element frame. This is often called when radical style
|
||||
* change precludes incremental reflow.
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
*
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD ReconstructDocElementHierarchy(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
|
||||
/////////////// Content change notifications //////////////////
|
||||
|
||||
/**
|
||||
* Notification that content was appended in the content tree.
|
||||
* This may have the side effect of creating frames for the new content.
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContainer the content node into which content was appended
|
||||
* @param aNewIndexInContainer the index in aContainer at which the first
|
||||
* content node was appended.
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content was inserted in the content tree.
|
||||
* This may have the side effect of creating frames for the new content.
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContainer the content node into which content was appended
|
||||
* @param aChild the content node that was inserted
|
||||
* @param aNewIndexInContainer the index of aChild in aContainer
|
||||
* @param aFrameState the layout history object used to initialize the new frame(s)
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer,
|
||||
nsILayoutHistoryState* aFrameState) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content was replaced in the content tree.
|
||||
* This may have the side effect of creating frames for the new content.
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContainer the content node into which content was appended
|
||||
* @param aOldChild the content node that was replaced
|
||||
* @param aNewChild the new content node that replaced aOldChild
|
||||
* @param aNewIndexInContainer the index of aNewChild in aContainer
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content was inserted in the content tree.
|
||||
* This may have the side effect of changing the frame tree
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContainer the content node into which content was appended
|
||||
* @param aChild the content node that was inserted
|
||||
* @param aNewIndexInContainer the index of aChild in aContainer
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content was changed in the content tree.
|
||||
* This may have the side effect of changing the frame tree
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContent the content node that was changed
|
||||
* @param aSubContent a hint to the frame system about the change
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Notification that the state of a content node has changed.
|
||||
* (ie: gained or lost focus, became active or hovered over)
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContent1 the content node whose state was changed
|
||||
* @param aContent2 an optional second content node whose state
|
||||
* has also changed. The meaning of aContent2
|
||||
* depends on the type of state change.
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2) = 0;
|
||||
|
||||
/**
|
||||
* Notification that an attribute was changed for a content node
|
||||
* This may have the side effect of changing the frame tree
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aContent the content node on which an attribute was changed
|
||||
* @param aNameSpaceID the name space for the changed attribute
|
||||
* @param aAttribute the attribute that was changed
|
||||
* @param aHint a hint about the effect of the change
|
||||
* see nsStyleConsts.h for legal values
|
||||
* any of the consts of the form NS_STYLE_HINT_*
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) = 0;
|
||||
|
||||
|
||||
/////////////// Style change notifications //////////////////
|
||||
|
||||
/**
|
||||
* A StyleRule has just been modified within a style sheet.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that contians the rule
|
||||
* @param aStyleRule the rule that was modified
|
||||
* @param aHint some possible info about the nature of the change.
|
||||
* see nsStyleConsts for hint values
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD StyleRuleChanged(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
|
||||
/**
|
||||
* A StyleRule has just been added to a style sheet.
|
||||
* This method is called automatically when the rule gets
|
||||
* added to the sheet. The style sheet passes this
|
||||
* notification to the document. The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been modified
|
||||
* @param aStyleRule the rule that was added
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD StyleRuleAdded(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
|
||||
/**
|
||||
* A StyleRule has just been removed from a style sheet.
|
||||
* This method is called automatically when the rule gets
|
||||
* removed from the sheet. The style sheet passes this
|
||||
* notification to the document. The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been modified
|
||||
* @param aStyleRule the rule that was removed
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
*/
|
||||
NS_IMETHOD StyleRuleRemoved(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
|
||||
/**
|
||||
* Method that actually handles style changes for effected frames.
|
||||
* Note: this may not need to be a public method. Use with extreme caution.
|
||||
*
|
||||
* @param aRestyleArray A list of effected frames.
|
||||
* @param aPresContext The presentation context.
|
||||
*
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD ProcessRestyledFrames(nsStyleChangeList& aRestyleArray,
|
||||
nsIPresContext* aPresContext) = 0;
|
||||
|
||||
/////////////// misc methods //////////////////////
|
||||
|
||||
/**
|
||||
* Notification that we were unable to render a replaced element.
|
||||
* Called when the replaced element can not be rendered, and we should
|
||||
* instead render the element's contents.
|
||||
* For HTML, the content object associated with aFrame should either be a IMG
|
||||
* element or an OBJECT element.
|
||||
* This may have the side effect of changing the frame tree.
|
||||
*
|
||||
* @param aPresShell the presentation shell
|
||||
* @param aPresContext the presentation context
|
||||
* @param aFrame the frame constructed for the replaced element
|
||||
*
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Request to create a continuing frame
|
||||
*
|
||||
* @param aPresShell the presentation shell
|
||||
* @param aPresContext the presentation context
|
||||
* @param aFrame the frame for which we need a continuation
|
||||
* @param aParentFrame the parent of aFrame
|
||||
* @param aContinuingFrame [OUT] the resulting frame
|
||||
*
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
|
||||
nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame** aContinuingFrame) = 0;
|
||||
|
||||
/** Request to find the primary frame associated with a given content object.
|
||||
* This is typically called by the pres shell when there is no mapping in
|
||||
* the pres shell hash table
|
||||
*
|
||||
* @param aPresContext the presentation context
|
||||
* @param aFrameManager the frame manager for the frame being sought
|
||||
* @param aContent the content node for which we seek a frame
|
||||
* @param aFrame [OUT] the resulting frame, if any. may be null,
|
||||
* indicating that no frame maps aContent
|
||||
* @param aHint an optional hint used to make the search for aFrame faster
|
||||
*/
|
||||
NS_IMETHOD FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
||||
nsIFrameManager* aFrameManager,
|
||||
nsIContent* aContent,
|
||||
nsIFrame** aFrame,
|
||||
nsFindFrameHint* aHint=nsnull) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIStyleFrameConstruction_h___ */
|
||||
325
mozilla/layout/base/public/nsIStyleSet.h
Normal file
325
mozilla/layout/base/public/nsIStyleSet.h
Normal file
@@ -0,0 +1,325 @@
|
||||
/* -*- 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 nsStyleSet_h___
|
||||
#define nsStyleSet_h___
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nsISupports.h"
|
||||
#include "nslayout.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIStyleRule;
|
||||
class nsIStyleSheet;
|
||||
class nsIStyleContext;
|
||||
class nsIStyleRuleSupplier;
|
||||
class nsIPresContext;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIDocument;
|
||||
class nsIFrameManager;
|
||||
class nsISupportsArray;
|
||||
struct nsFindFrameHint;
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
class nsISizeOfHandler;
|
||||
|
||||
class nsICSSPseudoComparator;
|
||||
|
||||
#define SHARE_STYLECONTEXTS
|
||||
|
||||
#ifdef SHARE_STYLECONTEXTS
|
||||
#include "nsHashtable.h"
|
||||
#endif
|
||||
|
||||
// IID for the nsIStyleSet interface {e59396b0-b244-11d1-8031-006008159b5a}
|
||||
#define NS_ISTYLE_SET_IID \
|
||||
{0xe59396b0, 0xb244, 0x11d1, {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
#ifdef SHARE_STYLECONTEXTS
|
||||
typedef PRUint32 scKey; // key for style contexts: it is a CRC32 value actually...
|
||||
#endif
|
||||
|
||||
class nsIStyleSet : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLE_SET_IID; return iid; }
|
||||
|
||||
// Style sheets are ordered, most significant first
|
||||
// NOTE: this is the reverse of the way documents store the sheets
|
||||
virtual void AppendOverrideStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual void InsertOverrideStyleSheetAfter(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aAfterSheet) = 0;
|
||||
virtual void InsertOverrideStyleSheetBefore(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aBeforeSheet) = 0;
|
||||
virtual void RemoveOverrideStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual PRInt32 GetNumberOfOverrideStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetOverrideStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
|
||||
// the ordering of document style sheets is given by the document
|
||||
virtual void AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument) = 0;
|
||||
virtual void RemoveDocStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual PRInt32 GetNumberOfDocStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetDocStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
|
||||
virtual void AppendBackstopStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual void InsertBackstopStyleSheetAfter(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aAfterSheet) = 0;
|
||||
virtual void InsertBackstopStyleSheetBefore(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aBeforeSheet) = 0;
|
||||
virtual void RemoveBackstopStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual PRInt32 GetNumberOfBackstopStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetBackstopStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
virtual void ReplaceBackstopStyleSheets(nsISupportsArray* aNewSheets) = 0;
|
||||
|
||||
// enable / disable the Quirk style sheet:
|
||||
// returns NS_FAILURE if none is found, otherwise NS_OK
|
||||
NS_IMETHOD EnableQuirkStyleSheet(PRBool aEnable) = 0;
|
||||
|
||||
|
||||
NS_IMETHOD NotifyStyleSheetStateChanged(PRBool aDisabled) = 0;
|
||||
|
||||
// get a style context for a non-pseudo frame
|
||||
virtual nsIStyleContext* ResolveStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique = PR_FALSE) = 0;
|
||||
|
||||
// get a style context for a pseudo-frame (ie: tag = NS_NewAtom(":first-line");
|
||||
virtual nsIStyleContext* ResolvePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique = PR_FALSE,
|
||||
nsICSSPseudoComparator* aComparator = nsnull) = 0;
|
||||
|
||||
// This funtions just like ResolvePseudoStyleFor except that it will
|
||||
// return nsnull if there are no explicit style rules for that
|
||||
// pseudo element
|
||||
virtual nsIStyleContext* ProbePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
PRBool aForceUnique = PR_FALSE) = 0;
|
||||
|
||||
// Get a new style context that lives in a different parent
|
||||
// The new context will be the same as the old if the new parent == the old parent
|
||||
NS_IMETHOD ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsIStyleContext* aNewParentContext,
|
||||
nsIStyleContext** aNewStyleContext) = 0;
|
||||
|
||||
// Test if style is dependent on content state
|
||||
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent) = 0;
|
||||
|
||||
// Create frames for the root content element and its child content
|
||||
NS_IMETHOD ConstructRootFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aDocElement,
|
||||
nsIFrame*& aFrameSubTree) = 0;
|
||||
|
||||
// Causes reconstruction of a frame hierarchy rooted by the
|
||||
// frame document element frame. This is often called when radical style
|
||||
// change precludes incremental reflow.
|
||||
NS_IMETHOD ReconstructDocElementHierarchy(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
// Notifications of changes to the content mpodel
|
||||
NS_IMETHOD ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2) = 0;
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
|
||||
// Style change notifications
|
||||
NS_IMETHOD StyleRuleChanged(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
NS_IMETHOD StyleRuleAdded(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
NS_IMETHOD StyleRuleRemoved(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
|
||||
// Notification that we were unable to render a replaced element.
|
||||
// Called when the replaced element can not be rendered, and we should
|
||||
// instead render the element's contents.
|
||||
// The content object associated with aFrame should either be a IMG
|
||||
// element or an OBJECT element.
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame) = 0;
|
||||
|
||||
// Request to create a continuing frame
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame** aContinuingFrame) = 0;
|
||||
|
||||
/** Request to find the primary frame associated with a given content object.
|
||||
* This is typically called by the pres shell when there is no mapping in
|
||||
* the pres shell hash table.
|
||||
* @param aPresContext the pres context
|
||||
* @param aFrameManager the frame manager
|
||||
* @param aContent the content we need to find a frame for
|
||||
* @param aFrame [OUT] the resulting frame
|
||||
* @param aHint optional performance hint, may be null
|
||||
*
|
||||
* @return NS_OK. aFrame will be null if no frame could be found
|
||||
*/
|
||||
NS_IMETHOD FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
||||
nsIFrameManager* aFrameManager,
|
||||
nsIContent* aContent,
|
||||
nsIFrame** aFrame,
|
||||
nsFindFrameHint* aHint=0) = 0;
|
||||
|
||||
// APIs for registering objects that can supply additional
|
||||
// rules during processing.
|
||||
NS_IMETHOD SetStyleRuleSupplier(nsIStyleRuleSupplier* aSupplier)=0;
|
||||
NS_IMETHOD GetStyleRuleSupplier(nsIStyleRuleSupplier** aSupplier)=0;
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) = 0;
|
||||
virtual void ListContexts(nsIStyleContext* aRootContext, FILE* out = stdout, PRInt32 aIndent = 0) = 0;
|
||||
|
||||
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize) = 0;
|
||||
virtual void ResetUniqueStyleItems(void) = 0;
|
||||
|
||||
// If changing the given attribute cannot affect style context, aAffects
|
||||
// will be PR_FALSE on return.
|
||||
NS_IMETHOD AttributeAffectsStyle(nsIAtom *aAttribute, nsIContent *aContent,
|
||||
PRBool &aAffects) = 0;
|
||||
|
||||
#ifdef SHARE_STYLECONTEXTS
|
||||
// add and remove from the cache of all contexts
|
||||
NS_IMETHOD AddStyleContext(nsIStyleContext *aNewStyleContext) = 0;
|
||||
NS_IMETHOD RemoveStyleContext(nsIStyleContext *aNewStyleContext) = 0;
|
||||
// find another context with the same style data
|
||||
// - if an exact match is found, the out-param aMatchingContext is set (AddRef'd)
|
||||
NS_IMETHOD FindMatchingContext(nsIStyleContext *aStyleContextToMatch,
|
||||
nsIStyleContext **aMatchingContext) = 0;
|
||||
NS_IMETHOD UpdateStyleContextKey(scKey aOldKey, scKey aNewKey) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewStyleSet(nsIStyleSet** aInstancePtrResult);
|
||||
|
||||
|
||||
class nsUniqueStyleItems : private nsVoidArray
|
||||
{
|
||||
public :
|
||||
// return a singleton instance of the nsUniqueStyleItems object
|
||||
static nsUniqueStyleItems *GetUniqueStyleItems( void ){
|
||||
if(mInstance == nsnull){
|
||||
#ifdef DEBUG
|
||||
nsUniqueStyleItems *pInstance =
|
||||
#endif
|
||||
new nsUniqueStyleItems;
|
||||
|
||||
NS_ASSERTION(pInstance == mInstance, "Singleton?");
|
||||
|
||||
// the ctor sets the mInstance static member variable...
|
||||
// if it is null, then we just end up returning null...
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
void *GetItem(void *aPtr){
|
||||
PRInt32 index = nsVoidArray::IndexOf(aPtr);
|
||||
if( index != -1){
|
||||
return nsVoidArray::ElementAt(index);
|
||||
} else {
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool AddItem(void *aPtr){
|
||||
if(nsVoidArray::IndexOf(aPtr) == -1){
|
||||
return nsVoidArray::AppendElement(aPtr);
|
||||
} else {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool RemoveItem(void *aPtr){
|
||||
return nsVoidArray::RemoveElement(aPtr);
|
||||
}
|
||||
|
||||
PRInt32 Count(void){
|
||||
return nsVoidArray::Count();
|
||||
}
|
||||
|
||||
void Clear(void){
|
||||
nsVoidArray::Clear();
|
||||
}
|
||||
protected:
|
||||
// disallow these:
|
||||
nsUniqueStyleItems( const nsUniqueStyleItems& src);
|
||||
nsUniqueStyleItems& operator =(const nsUniqueStyleItems& src);
|
||||
|
||||
// make this accessable to factory only
|
||||
nsUniqueStyleItems(void) : nsVoidArray(){
|
||||
NS_ASSERTION(mInstance == nsnull, "singleton?");
|
||||
mInstance=this;
|
||||
}
|
||||
|
||||
static nsUniqueStyleItems *mInstance;
|
||||
};
|
||||
|
||||
#define UNIQUE_STYLE_ITEMS(__ptr) \
|
||||
nsUniqueStyleItems* __ptr = nsUniqueStyleItems::GetUniqueStyleItems(); \
|
||||
NS_ASSERTION(__ptr != nsnull, "UniqueItems cannot be null: error in nsUniqueStyleItems factory");
|
||||
|
||||
/** a simple struct (that may someday be expanded)
|
||||
* that contains data supplied by the caller to help
|
||||
* the style set find a frame for a content node
|
||||
*/
|
||||
struct nsFindFrameHint
|
||||
{
|
||||
nsIFrame *mPrimaryFrameForPrevSibling; // weak ref to the primary frame for the content for which we need a frame
|
||||
nsFindFrameHint() {
|
||||
mPrimaryFrameForPrevSibling = nsnull;
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* nsIStyleSet_h___ */
|
||||
41
mozilla/layout/base/public/nsITextFrame.h
Normal file
41
mozilla/layout/base/public/nsITextFrame.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/* -*- 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* IBM Corporation. Portions created by IBM are
|
||||
* Copyright (C) 2000 IBM Corporation.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsITextFrame_h___
|
||||
#define nsITextFrame_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// {2DC80A03-66EF-11d4-BA58-006008CD3717}
|
||||
#define NS_ITEXTFRAME_IID \
|
||||
{ 0x2dc80a03, 0x66ef, 0x11d4, { 0xba, 0x58, 0x00, 0x60, 0x08, 0xcd, 0x37, 0x17 } }
|
||||
|
||||
class nsITextFrame : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITEXTFRAME_IID)
|
||||
|
||||
NS_IMETHOD SetOffsets(PRInt32 aStart, PRInt32 aEnd) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsITextFrame_h___ */
|
||||
66
mozilla/layout/base/public/nsStyleChangeList.h
Normal file
66
mozilla/layout/base/public/nsStyleChangeList.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* -*- 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 nsStyleChangeList_h___
|
||||
#define nsStyleChangeList_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsError.h"
|
||||
class nsIFrame;
|
||||
class nsIContent;
|
||||
|
||||
// XXX would all platforms support putting this inside the list?
|
||||
struct nsStyleChangeData {
|
||||
nsIFrame* mFrame;
|
||||
nsIContent* mContent;
|
||||
PRInt32 mHint;
|
||||
};
|
||||
|
||||
static const PRUint32 kStyleChangeBufferSize = 10;
|
||||
|
||||
class NS_LAYOUT nsStyleChangeList {
|
||||
public:
|
||||
nsStyleChangeList(void);
|
||||
~nsStyleChangeList(void);
|
||||
|
||||
PRInt32 Count(void) const {
|
||||
return mCount;
|
||||
}
|
||||
|
||||
nsresult ChangeAt(PRInt32 aIndex, nsIFrame*& aFrame, nsIContent*& aContent,
|
||||
PRInt32& aHint) const;
|
||||
|
||||
nsresult AppendChange(nsIFrame* aFrame, nsIContent* aContent, PRInt32 aHint);
|
||||
|
||||
void Clear(void);
|
||||
|
||||
protected:
|
||||
nsStyleChangeList& operator=(const nsStyleChangeList& aCopy);
|
||||
PRBool operator==(const nsStyleChangeList& aOther) const;
|
||||
|
||||
nsStyleChangeData* mArray;
|
||||
PRInt32 mArraySize;
|
||||
PRInt32 mCount;
|
||||
nsStyleChangeData mBuffer[kStyleChangeBufferSize];
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsStyleChangeList_h___ */
|
||||
581
mozilla/layout/base/public/nsStyleConsts.h
Normal file
581
mozilla/layout/base/public/nsStyleConsts.h
Normal file
@@ -0,0 +1,581 @@
|
||||
/* -*- 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 nsStyleConsts_h___
|
||||
#define nsStyleConsts_h___
|
||||
|
||||
#include "nsFont.h"
|
||||
|
||||
// XXX fold this into nsIStyleContext and group by nsStyleXXX struct
|
||||
|
||||
// Defines for various style related constants
|
||||
|
||||
// Style change hints
|
||||
#define NS_STYLE_HINT_UNKNOWN -1
|
||||
#define NS_STYLE_HINT_NONE 0 // change has no impact
|
||||
#define NS_STYLE_HINT_ATTRCHANGE 1 // change should cause notification to frame but nothing else
|
||||
#define NS_STYLE_HINT_AURAL 2 // change was aural
|
||||
#define NS_STYLE_HINT_CONTENT 3 // change was contentual (ie: SRC=)
|
||||
#define NS_STYLE_HINT_VISUAL 4 // change was visual only (ie: COLOR=)
|
||||
#define NS_STYLE_HINT_REFLOW 5 // change requires reflow (ie: WIDTH=)
|
||||
#define NS_STYLE_HINT_FRAMECHANGE 6 // change requires frame change (ie: display:)
|
||||
#define NS_STYLE_HINT_RECONSTRUCT_ALL 7 // change requires reconstruction of entire document (ie: style sheet change)
|
||||
#define NS_STYLE_HINT_MAX NS_STYLE_HINT_RECONSTRUCT_ALL
|
||||
|
||||
// Indicies into border/padding/margin arrays
|
||||
#define NS_SIDE_TOP 0
|
||||
#define NS_SIDE_RIGHT 1
|
||||
#define NS_SIDE_BOTTOM 2
|
||||
#define NS_SIDE_LEFT 3
|
||||
|
||||
|
||||
// box-sizing
|
||||
#define NS_STYLE_BOX_SIZING_CONTENT 0
|
||||
#define NS_STYLE_BOX_SIZING_PADDING 1
|
||||
#define NS_STYLE_BOX_SIZING_BORDER 2
|
||||
|
||||
// float-edge
|
||||
#define NS_STYLE_FLOAT_EDGE_CONTENT 0
|
||||
#define NS_STYLE_FLOAT_EDGE_PADDING 1
|
||||
#define NS_STYLE_FLOAT_EDGE_BORDER 2
|
||||
#define NS_STYLE_FLOAT_EDGE_MARGIN 3
|
||||
|
||||
// key-equivalent
|
||||
#define NS_STYLE_KEY_EQUIVALENT_NONE 0
|
||||
|
||||
// resizer
|
||||
#define NS_STYLE_RESIZER_NONE 0x00
|
||||
#define NS_STYLE_RESIZER_HORIZONTAL 0x01 // bits
|
||||
#define NS_STYLE_RESIZER_VERTICAL 0x02 // bits
|
||||
#define NS_STYLE_RESIZER_BOTH 0x03 // bits
|
||||
#define NS_STYLE_RESIZER_AUTO 0x04 // bits
|
||||
|
||||
// user-focus
|
||||
#define NS_STYLE_USER_FOCUS_NONE 0
|
||||
#define NS_STYLE_USER_FOCUS_IGNORE 1
|
||||
#define NS_STYLE_USER_FOCUS_NORMAL 2
|
||||
#define NS_STYLE_USER_FOCUS_SELECT_ALL 3
|
||||
#define NS_STYLE_USER_FOCUS_SELECT_BEFORE 4
|
||||
#define NS_STYLE_USER_FOCUS_SELECT_AFTER 5
|
||||
#define NS_STYLE_USER_FOCUS_SELECT_SAME 6
|
||||
#define NS_STYLE_USER_FOCUS_SELECT_MENU 7
|
||||
|
||||
// user-select
|
||||
#define NS_STYLE_USER_SELECT_NONE 0
|
||||
#define NS_STYLE_USER_SELECT_TEXT 1
|
||||
#define NS_STYLE_USER_SELECT_ELEMENT 2
|
||||
#define NS_STYLE_USER_SELECT_ELEMENTS 3
|
||||
#define NS_STYLE_USER_SELECT_ALL 4
|
||||
#define NS_STYLE_USER_SELECT_TOGGLE 5
|
||||
#define NS_STYLE_USER_SELECT_TRI_STATE 6
|
||||
#define NS_STYLE_USER_SELECT_AUTO 7 // internal value - please use nsFrame::IsSelectable()
|
||||
#define NS_STYLE_USER_SELECT_MOZ_ALL 8 // force selection of all children - bug 48096
|
||||
|
||||
// user-input
|
||||
#define NS_STYLE_USER_INPUT_NONE 0
|
||||
#define NS_STYLE_USER_INPUT_ENABLED 1
|
||||
#define NS_STYLE_USER_INPUT_DISABLED 2
|
||||
#define NS_STYLE_USER_INPUT_AUTO 3
|
||||
|
||||
// user-modify
|
||||
#define NS_STYLE_USER_MODIFY_READ_ONLY 0
|
||||
#define NS_STYLE_USER_MODIFY_READ_WRITE 1
|
||||
#define NS_STYLE_USER_MODIFY_WRITE_ONLY 2
|
||||
|
||||
// box-orient
|
||||
#define NS_STYLE_BOX_ORIENT_HORIZONTAL 0
|
||||
#define NS_STYLE_BOX_ORIENT_VERTICAL 1
|
||||
|
||||
// Azimuth - See nsStyleAural
|
||||
#define NS_STYLE_AZIMUTH_LEFT_SIDE 0x00
|
||||
#define NS_STYLE_AZIMUTH_FAR_LEFT 0x01
|
||||
#define NS_STYLE_AZIMUTH_LEFT 0x02
|
||||
#define NS_STYLE_AZIMUTH_CENTER_LEFT 0x03
|
||||
#define NS_STYLE_AZIMUTH_CENTER 0x04
|
||||
#define NS_STYLE_AZIMUTH_CENTER_RIGHT 0x05
|
||||
#define NS_STYLE_AZIMUTH_RIGHT 0x06
|
||||
#define NS_STYLE_AZIMUTH_FAR_RIGHT 0x07
|
||||
#define NS_STYLE_AZIMUTH_RIGHT_SIDE 0x08
|
||||
#define NS_STYLE_AZIMUTH_BEHIND 0x80 // bits
|
||||
#define NS_STYLE_AZIMUTH_LEFTWARDS 0x10 // bits
|
||||
#define NS_STYLE_AZIMUTH_RIGHTWARDS 0x20 // bits
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_ELEVATION_BELOW 1
|
||||
#define NS_STYLE_ELEVATION_LEVEL 2
|
||||
#define NS_STYLE_ELEVATION_ABOVE 3
|
||||
#define NS_STYLE_ELEVATION_HIGHER 4
|
||||
#define NS_STYLE_ELEVATION_LOWER 5
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_PITCH_X_LOW 1
|
||||
#define NS_STYLE_PITCH_LOW 2
|
||||
#define NS_STYLE_PITCH_MEDIUM 3
|
||||
#define NS_STYLE_PITCH_HIGH 4
|
||||
#define NS_STYLE_PITCH_X_HIGH 5
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_PLAY_DURING_MIX 0x01 // bit field
|
||||
#define NS_STYLE_PLAY_DURING_REPEAT 0x02
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_SPEAK_NONE 0
|
||||
#define NS_STYLE_SPEAK_NORMAL 1
|
||||
#define NS_STYLE_SPEAK_SPELL_OUT 2
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_SPEAK_HEADER_ONCE 0
|
||||
#define NS_STYLE_SPEAK_HEADER_ALWAYS 1
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_SPEAK_NUMERAL_DIGITS 0
|
||||
#define NS_STYLE_SPEAK_NUMERAL_CONTINUOUS 1
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_SPEAK_PUNCTUATION_NONE 0
|
||||
#define NS_STYLE_SPEAK_PUNCTUATION_CODE 1
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_SPEECH_RATE_X_SLOW 0
|
||||
#define NS_STYLE_SPEECH_RATE_SLOW 1
|
||||
#define NS_STYLE_SPEECH_RATE_MEDIUM 2
|
||||
#define NS_STYLE_SPEECH_RATE_FAST 3
|
||||
#define NS_STYLE_SPEECH_RATE_X_FAST 4
|
||||
#define NS_STYLE_SPEECH_RATE_FASTER 10
|
||||
#define NS_STYLE_SPEECH_RATE_SLOWER 11
|
||||
|
||||
// See nsStyleAural
|
||||
#define NS_STYLE_VOLUME_SILENT 0
|
||||
#define NS_STYLE_VOLUME_X_SOFT 1
|
||||
#define NS_STYLE_VOLUME_SOFT 2
|
||||
#define NS_STYLE_VOLUME_MEDIUM 3
|
||||
#define NS_STYLE_VOLUME_LOUD 4
|
||||
#define NS_STYLE_VOLUME_X_LOUD 5
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_BG_ATTACHMENT_SCROLL 0
|
||||
#define NS_STYLE_BG_ATTACHMENT_FIXED 1
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_COLOR_TRANSPARENT 0
|
||||
#define NS_STYLE_COLOR_INVERT 1
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_BG_COLOR_TRANSPARENT 0x01
|
||||
#define NS_STYLE_BG_IMAGE_NONE 0x02
|
||||
#define NS_STYLE_BG_X_POSITION_PERCENT 0x04
|
||||
#define NS_STYLE_BG_X_POSITION_LENGTH 0x08
|
||||
#define NS_STYLE_BG_Y_POSITION_PERCENT 0x10
|
||||
#define NS_STYLE_BG_Y_POSITION_LENGTH 0x20
|
||||
#define NS_STYLE_BG_PROPAGATED_TO_PARENT 0x40 // for the BodyFixupRule
|
||||
#define NS_STYLE_BG_PROPAGATED_FROM_CHILD 0x80 // '' ''
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_BG_REPEAT_OFF 0x00
|
||||
#define NS_STYLE_BG_REPEAT_X 0x01
|
||||
#define NS_STYLE_BG_REPEAT_Y 0x02
|
||||
#define NS_STYLE_BG_REPEAT_XY 0x03
|
||||
|
||||
// See nsStyleTable
|
||||
#define NS_STYLE_BORDER_COLLAPSE 0
|
||||
#define NS_STYLE_BORDER_SEPARATE 1
|
||||
|
||||
// See nsStyleBorder mBorder enum values
|
||||
#define NS_STYLE_BORDER_WIDTH_THIN 0
|
||||
#define NS_STYLE_BORDER_WIDTH_MEDIUM 1
|
||||
#define NS_STYLE_BORDER_WIDTH_THICK 2
|
||||
// XXX chopping block #define NS_STYLE_BORDER_WIDTH_LENGTH_VALUE 3
|
||||
|
||||
// See nsStyleBorder mBorderStyle
|
||||
#define NS_STYLE_BORDER_STYLE_NONE 0
|
||||
#define NS_STYLE_BORDER_STYLE_GROOVE 1
|
||||
#define NS_STYLE_BORDER_STYLE_RIDGE 2
|
||||
#define NS_STYLE_BORDER_STYLE_DOTTED 3
|
||||
#define NS_STYLE_BORDER_STYLE_DASHED 4
|
||||
#define NS_STYLE_BORDER_STYLE_SOLID 5
|
||||
#define NS_STYLE_BORDER_STYLE_DOUBLE 6
|
||||
#define NS_STYLE_BORDER_STYLE_BLANK 7
|
||||
#define NS_STYLE_BORDER_STYLE_INSET 8
|
||||
#define NS_STYLE_BORDER_STYLE_OUTSET 9
|
||||
#define NS_STYLE_BORDER_STYLE_HIDDEN 10
|
||||
#define NS_STYLE_BORDER_STYLE_BG_INSET 11
|
||||
#define NS_STYLE_BORDER_STYLE_BG_OUTSET 12
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_CLEAR_NONE 0
|
||||
#define NS_STYLE_CLEAR_LEFT 1
|
||||
#define NS_STYLE_CLEAR_RIGHT 2
|
||||
#define NS_STYLE_CLEAR_LEFT_AND_RIGHT 3
|
||||
#define NS_STYLE_CLEAR_LINE 4
|
||||
#define NS_STYLE_CLEAR_BLOCK 5
|
||||
#define NS_STYLE_CLEAR_COLUMN 6
|
||||
#define NS_STYLE_CLEAR_PAGE 7
|
||||
#define NS_STYLE_CLEAR_LAST_VALUE NS_STYLE_CLEAR_PAGE
|
||||
|
||||
// See
|
||||
#define NS_STYLE_CONTENT_OPEN_QUOTE 0
|
||||
#define NS_STYLE_CONTENT_CLOSE_QUOTE 1
|
||||
#define NS_STYLE_CONTENT_NO_OPEN_QUOTE 2
|
||||
#define NS_STYLE_CONTENT_NO_CLOSE_QUOTE 3
|
||||
|
||||
// See nsStyleColor
|
||||
#define NS_STYLE_CURSOR_AUTO 1
|
||||
#define NS_STYLE_CURSOR_CROSSHAIR 2
|
||||
#define NS_STYLE_CURSOR_DEFAULT 3 // ie: an arrow
|
||||
#define NS_STYLE_CURSOR_POINTER 4 // for links
|
||||
#define NS_STYLE_CURSOR_MOVE 5
|
||||
#define NS_STYLE_CURSOR_E_RESIZE 6
|
||||
#define NS_STYLE_CURSOR_NE_RESIZE 7
|
||||
#define NS_STYLE_CURSOR_NW_RESIZE 8
|
||||
#define NS_STYLE_CURSOR_N_RESIZE 9
|
||||
#define NS_STYLE_CURSOR_SE_RESIZE 10
|
||||
#define NS_STYLE_CURSOR_SW_RESIZE 11
|
||||
#define NS_STYLE_CURSOR_S_RESIZE 12
|
||||
#define NS_STYLE_CURSOR_W_RESIZE 13
|
||||
#define NS_STYLE_CURSOR_TEXT 14 // ie: i-beam
|
||||
#define NS_STYLE_CURSOR_WAIT 15
|
||||
#define NS_STYLE_CURSOR_HELP 16
|
||||
#define NS_STYLE_CURSOR_COPY 17 // CSS3
|
||||
#define NS_STYLE_CURSOR_ALIAS 18
|
||||
#define NS_STYLE_CURSOR_CONTEXT_MENU 19
|
||||
#define NS_STYLE_CURSOR_CELL 20
|
||||
#define NS_STYLE_CURSOR_GRAB 21
|
||||
#define NS_STYLE_CURSOR_GRABBING 22
|
||||
#define NS_STYLE_CURSOR_SPINNING 23
|
||||
#define NS_STYLE_CURSOR_COUNT_UP 24
|
||||
#define NS_STYLE_CURSOR_COUNT_DOWN 25
|
||||
#define NS_STYLE_CURSOR_COUNT_UP_DOWN 26
|
||||
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_DIRECTION_LTR 0
|
||||
#define NS_STYLE_DIRECTION_RTL 1
|
||||
#define NS_STYLE_DIRECTION_INHERIT 2
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_DISPLAY_NONE 0
|
||||
#define NS_STYLE_DISPLAY_BLOCK 1
|
||||
#define NS_STYLE_DISPLAY_INLINE 2
|
||||
#define NS_STYLE_DISPLAY_INLINE_BLOCK 3
|
||||
#define NS_STYLE_DISPLAY_LIST_ITEM 4
|
||||
#define NS_STYLE_DISPLAY_MARKER 5
|
||||
#define NS_STYLE_DISPLAY_RUN_IN 6
|
||||
#define NS_STYLE_DISPLAY_COMPACT 7
|
||||
#define NS_STYLE_DISPLAY_TABLE 8
|
||||
#define NS_STYLE_DISPLAY_INLINE_TABLE 9
|
||||
#define NS_STYLE_DISPLAY_TABLE_ROW_GROUP 10
|
||||
#define NS_STYLE_DISPLAY_TABLE_COLUMN 11
|
||||
#define NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP 12
|
||||
#define NS_STYLE_DISPLAY_TABLE_HEADER_GROUP 13
|
||||
#define NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP 14
|
||||
#define NS_STYLE_DISPLAY_TABLE_ROW 15
|
||||
#define NS_STYLE_DISPLAY_TABLE_CELL 16
|
||||
#define NS_STYLE_DISPLAY_TABLE_CAPTION 17
|
||||
#define NS_STYLE_DISPLAY_MENU 18
|
||||
#define NS_STYLE_DISPLAY_BOX 18
|
||||
#define NS_STYLE_DISPLAY_INLINE_BOX 19
|
||||
#define NS_STYLE_DISPLAY_GRID 20
|
||||
#define NS_STYLE_DISPLAY_INLINE_GRID 21
|
||||
#define NS_STYLE_DISPLAY_GRID_GROUP 22
|
||||
#define NS_STYLE_DISPLAY_GRID_LINE 23
|
||||
#define NS_STYLE_DISPLAY_STACK 24
|
||||
#define NS_STYLE_DISPLAY_INLINE_STACK 25
|
||||
#define NS_STYLE_DISPLAY_DECK 26
|
||||
#define NS_STYLE_DISPLAY_BULLETINBOARD 27
|
||||
#define NS_STYLE_DISPLAY_POPUP 28
|
||||
#define NS_STYLE_DISPLAY_GROUPBOX 29
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_FLOAT_NONE 0
|
||||
#define NS_STYLE_FLOAT_LEFT 1
|
||||
#define NS_STYLE_FLOAT_RIGHT 2
|
||||
|
||||
// See nsStyleFont
|
||||
#define NS_STYLE_FONT_STYLE_NORMAL 0
|
||||
#define NS_STYLE_FONT_STYLE_ITALIC 1
|
||||
#define NS_STYLE_FONT_STYLE_OBLIQUE 2
|
||||
|
||||
// See nsStyleFont
|
||||
#define NS_STYLE_FONT_VARIANT_NORMAL 0
|
||||
#define NS_STYLE_FONT_VARIANT_SMALL_CAPS 1
|
||||
|
||||
// See nsStyleFont
|
||||
#define NS_STYLE_FONT_WEIGHT_NORMAL 400
|
||||
#define NS_STYLE_FONT_WEIGHT_BOLD 700
|
||||
#define NS_STYLE_FONT_WEIGHT_BOLDER 1
|
||||
#define NS_STYLE_FONT_WEIGHT_LIGHTER -1
|
||||
|
||||
// See nsStyleFont
|
||||
#define NS_STYLE_FONT_SIZE_XXSMALL 0
|
||||
#define NS_STYLE_FONT_SIZE_XSMALL 1
|
||||
#define NS_STYLE_FONT_SIZE_SMALL 2
|
||||
#define NS_STYLE_FONT_SIZE_MEDIUM 3
|
||||
#define NS_STYLE_FONT_SIZE_LARGE 4
|
||||
#define NS_STYLE_FONT_SIZE_XLARGE 5
|
||||
#define NS_STYLE_FONT_SIZE_XXLARGE 6
|
||||
#define NS_STYLE_FONT_SIZE_LARGER 7
|
||||
#define NS_STYLE_FONT_SIZE_SMALLER 8
|
||||
|
||||
// See nsStyleFont
|
||||
#define NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED -4
|
||||
#define NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED -3
|
||||
#define NS_STYLE_FONT_STRETCH_CONDENSED -2
|
||||
#define NS_STYLE_FONT_STRETCH_SEMI_CONDENSED -1
|
||||
#define NS_STYLE_FONT_STRETCH_NORMAL 0
|
||||
#define NS_STYLE_FONT_STRETCH_SEMI_EXPANDED 1
|
||||
#define NS_STYLE_FONT_STRETCH_EXPANDED 2
|
||||
#define NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED 3
|
||||
#define NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED 4
|
||||
#define NS_STYLE_FONT_STRETCH_WIDER 10
|
||||
#define NS_STYLE_FONT_STRETCH_NARROWER -10
|
||||
|
||||
// See nsStyleFont mFlags
|
||||
#define NS_STYLE_FONT_DEFAULT 0x00
|
||||
#define NS_STYLE_FONT_SIZE_EXPLICIT 0x01
|
||||
#define NS_STYLE_FONT_FACE_EXPLICIT 0x02
|
||||
#define NS_STYLE_FONT_USE_FIXED 0x04
|
||||
|
||||
// See nsStyleFont - system fonts
|
||||
#define NS_STYLE_FONT_CAPTION 1 // css2
|
||||
#define NS_STYLE_FONT_ICON 2
|
||||
#define NS_STYLE_FONT_MENU 3
|
||||
#define NS_STYLE_FONT_MESSAGE_BOX 4
|
||||
#define NS_STYLE_FONT_SMALL_CAPTION 5
|
||||
#define NS_STYLE_FONT_STATUS_BAR 6
|
||||
#define NS_STYLE_FONT_WINDOW 7 // css3
|
||||
#define NS_STYLE_FONT_DOCUMENT 8
|
||||
#define NS_STYLE_FONT_WORKSPACE 9
|
||||
#define NS_STYLE_FONT_DESKTOP 10
|
||||
#define NS_STYLE_FONT_INFO 11
|
||||
#define NS_STYLE_FONT_DIALOG 12
|
||||
#define NS_STYLE_FONT_BUTTON 13
|
||||
#define NS_STYLE_FONT_PULL_DOWN_MENU 14
|
||||
#define NS_STYLE_FONT_LIST 15
|
||||
#define NS_STYLE_FONT_FIELD 16
|
||||
|
||||
// See nsStylePosition.mPosition
|
||||
#define NS_STYLE_POSITION_NORMAL 0
|
||||
#define NS_STYLE_POSITION_RELATIVE 1
|
||||
#define NS_STYLE_POSITION_ABSOLUTE 2
|
||||
#define NS_STYLE_POSITION_FIXED 3
|
||||
|
||||
// See nsStylePosition.mClip
|
||||
#define NS_STYLE_CLIP_AUTO 0x00
|
||||
#define NS_STYLE_CLIP_INHERIT 0x01
|
||||
#define NS_STYLE_CLIP_RECT 0x02
|
||||
#define NS_STYLE_CLIP_TYPE_MASK 0x0F
|
||||
#define NS_STYLE_CLIP_LEFT_AUTO 0x10
|
||||
#define NS_STYLE_CLIP_TOP_AUTO 0x20
|
||||
#define NS_STYLE_CLIP_RIGHT_AUTO 0x40
|
||||
#define NS_STYLE_CLIP_BOTTOM_AUTO 0x80
|
||||
|
||||
// FRAME/FRAMESET/IFRAME specific values including backward compatibility. Boolean values with
|
||||
// the same meaning (e.g. 1 & yes) may need to be distinguished for correct mode processing
|
||||
#define NS_STYLE_FRAME_YES 0
|
||||
#define NS_STYLE_FRAME_NO 1
|
||||
#define NS_STYLE_FRAME_0 2
|
||||
#define NS_STYLE_FRAME_1 3
|
||||
#define NS_STYLE_FRAME_ON 4
|
||||
#define NS_STYLE_FRAME_OFF 5
|
||||
#define NS_STYLE_FRAME_AUTO 6
|
||||
#define NS_STYLE_FRAME_SCROLL 7
|
||||
#define NS_STYLE_FRAME_NOSCROLL 8
|
||||
|
||||
// See nsStylePosition.mOverflow
|
||||
#define NS_STYLE_OVERFLOW_VISIBLE 0
|
||||
#define NS_STYLE_OVERFLOW_HIDDEN 1
|
||||
#define NS_STYLE_OVERFLOW_SCROLL 2
|
||||
#define NS_STYLE_OVERFLOW_AUTO 3
|
||||
#define NS_STYLE_OVERFLOW_SCROLLBARS_NONE 4
|
||||
#define NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL 5
|
||||
#define NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL 6
|
||||
|
||||
// See nsStyleList
|
||||
#define NS_STYLE_LIST_STYLE_NONE 0
|
||||
#define NS_STYLE_LIST_STYLE_DISC 1
|
||||
#define NS_STYLE_LIST_STYLE_CIRCLE 2
|
||||
#define NS_STYLE_LIST_STYLE_SQUARE 3
|
||||
#define NS_STYLE_LIST_STYLE_DECIMAL 4
|
||||
#define NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO 5
|
||||
#define NS_STYLE_LIST_STYLE_LOWER_ROMAN 6
|
||||
#define NS_STYLE_LIST_STYLE_UPPER_ROMAN 7
|
||||
#define NS_STYLE_LIST_STYLE_LOWER_GREEK 8
|
||||
#define NS_STYLE_LIST_STYLE_LOWER_ALPHA 9
|
||||
#define NS_STYLE_LIST_STYLE_LOWER_LATIN 9 // == ALPHA
|
||||
#define NS_STYLE_LIST_STYLE_UPPER_ALPHA 10
|
||||
#define NS_STYLE_LIST_STYLE_UPPER_LATIN 10 // == ALPHA
|
||||
#define NS_STYLE_LIST_STYLE_HEBREW 11
|
||||
#define NS_STYLE_LIST_STYLE_ARMENIAN 12
|
||||
#define NS_STYLE_LIST_STYLE_GEORGIAN 13
|
||||
#define NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC 14
|
||||
#define NS_STYLE_LIST_STYLE_HIRAGANA 15
|
||||
#define NS_STYLE_LIST_STYLE_KATAKANA 16
|
||||
#define NS_STYLE_LIST_STYLE_HIRAGANA_IROHA 17
|
||||
#define NS_STYLE_LIST_STYLE_KATAKANA_IROHA 18
|
||||
#define NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN 19
|
||||
#define NS_STYLE_LIST_STYLE_OLD_UPPER_ROMAN 20
|
||||
#define NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA 21
|
||||
#define NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA 22
|
||||
#define NS_STYLE_LIST_STYLE_OLD_DECIMAL 23
|
||||
#define NS_STYLE_LIST_STYLE_CJK_HEAVENLY_STEM 24
|
||||
#define NS_STYLE_LIST_STYLE_CJK_EARTHLY_BRANCH 25
|
||||
#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL 26
|
||||
#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL 27
|
||||
#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL 28
|
||||
#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL 29
|
||||
#define NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL 30
|
||||
#define NS_STYLE_LIST_STYLE_JAPANESE_FORMAL 31
|
||||
#define NS_STYLE_LIST_STYLE_ARABIC_INDIC 32
|
||||
#define NS_STYLE_LIST_STYLE_PERSIAN 33
|
||||
#define NS_STYLE_LIST_STYLE_URDU 34
|
||||
#define NS_STYLE_LIST_STYLE_DEVANAGARI 35
|
||||
#define NS_STYLE_LIST_STYLE_GURMUKHI 36
|
||||
#define NS_STYLE_LIST_STYLE_GUJARATI 37
|
||||
#define NS_STYLE_LIST_STYLE_ORIYA 38
|
||||
#define NS_STYLE_LIST_STYLE_KANNADA 39
|
||||
#define NS_STYLE_LIST_STYLE_MALAYALAM 40
|
||||
#define NS_STYLE_LIST_STYLE_BENGALI 41
|
||||
#define NS_STYLE_LIST_STYLE_TAMIL 42
|
||||
#define NS_STYLE_LIST_STYLE_TELUGU 43
|
||||
#define NS_STYLE_LIST_STYLE_THAI 44
|
||||
#define NS_STYLE_LIST_STYLE_LAO 45
|
||||
#define NS_STYLE_LIST_STYLE_MYANMAR 46
|
||||
#define NS_STYLE_LIST_STYLE_KHMER 47
|
||||
#define NS_STYLE_LIST_STYLE_BASIC 100 // not in css
|
||||
|
||||
// See nsStyleList
|
||||
#define NS_STYLE_LIST_STYLE_POSITION_INSIDE 0
|
||||
#define NS_STYLE_LIST_STYLE_POSITION_OUTSIDE 1
|
||||
|
||||
// See nsStyleMargin
|
||||
#define NS_STYLE_MARGIN_SIZE_AUTO 0
|
||||
|
||||
// See nsStyleText
|
||||
//
|
||||
// Note: make sure the numbers are less than the numbers that start
|
||||
// the vertical_align values below!
|
||||
#define NS_STYLE_TEXT_ALIGN_DEFAULT 0
|
||||
#define NS_STYLE_TEXT_ALIGN_LEFT 1
|
||||
#define NS_STYLE_TEXT_ALIGN_RIGHT 2
|
||||
#define NS_STYLE_TEXT_ALIGN_CENTER 3
|
||||
#define NS_STYLE_TEXT_ALIGN_JUSTIFY 4
|
||||
#define NS_STYLE_TEXT_ALIGN_CHAR 5 //align based on a certain character, for table cell
|
||||
#define NS_STYLE_TEXT_ALIGN_MOZ_CENTER 6
|
||||
#define NS_STYLE_TEXT_ALIGN_MOZ_RIGHT 7
|
||||
|
||||
// See nsStyleText, nsStyleFont
|
||||
#define NS_STYLE_TEXT_DECORATION_NONE 0
|
||||
#define NS_STYLE_TEXT_DECORATION_UNDERLINE NS_FONT_DECORATION_UNDERLINE
|
||||
#define NS_STYLE_TEXT_DECORATION_OVERLINE NS_FONT_DECORATION_OVERLINE
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_THROUGH NS_FONT_DECORATION_LINE_THROUGH
|
||||
#define NS_STYLE_TEXT_DECORATION_BLINK 0x8
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_TEXT_TRANSFORM_NONE 0
|
||||
#define NS_STYLE_TEXT_TRANSFORM_CAPITALIZE 1
|
||||
#define NS_STYLE_TEXT_TRANSFORM_LOWERCASE 2
|
||||
#define NS_STYLE_TEXT_TRANSFORM_UPPERCASE 3
|
||||
|
||||
// See nsStyleText
|
||||
// Note: these values pickup after the text-align values because there
|
||||
// are a few html cases where an object can have both types of
|
||||
// alignment applied with a single attribute
|
||||
#define NS_STYLE_VERTICAL_ALIGN_BASELINE 10
|
||||
#define NS_STYLE_VERTICAL_ALIGN_SUB 11
|
||||
#define NS_STYLE_VERTICAL_ALIGN_SUPER 12
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TOP 13
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TEXT_TOP 14
|
||||
#define NS_STYLE_VERTICAL_ALIGN_MIDDLE 15
|
||||
#define NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM 16
|
||||
#define NS_STYLE_VERTICAL_ALIGN_BOTTOM 17
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_VISIBILITY_HIDDEN 0
|
||||
#define NS_STYLE_VISIBILITY_VISIBLE 1
|
||||
#define NS_STYLE_VISIBILITY_COLLAPSE 2
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_WHITESPACE_NORMAL 0
|
||||
#define NS_STYLE_WHITESPACE_PRE 1
|
||||
#define NS_STYLE_WHITESPACE_NOWRAP 2
|
||||
#define NS_STYLE_WHITESPACE_MOZ_PRE_WRAP 3
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_UNICODE_BIDI_NORMAL 0
|
||||
#define NS_STYLE_UNICODE_BIDI_EMBED 1
|
||||
#define NS_STYLE_UNICODE_BIDI_OVERRIDE 2
|
||||
#ifdef IBMBIDI
|
||||
#define NS_STYLE_UNICODE_BIDI_INHERIT 3
|
||||
#endif
|
||||
|
||||
// See nsStyleTable (here for HTML 4.0 for now, should probably change to side flags)
|
||||
#define NS_STYLE_TABLE_FRAME_NONE 0
|
||||
#define NS_STYLE_TABLE_FRAME_ABOVE 1
|
||||
#define NS_STYLE_TABLE_FRAME_BELOW 2
|
||||
#define NS_STYLE_TABLE_FRAME_HSIDES 3
|
||||
#define NS_STYLE_TABLE_FRAME_VSIDES 4
|
||||
#define NS_STYLE_TABLE_FRAME_LEFT 5
|
||||
#define NS_STYLE_TABLE_FRAME_RIGHT 6
|
||||
#define NS_STYLE_TABLE_FRAME_BOX 7
|
||||
#define NS_STYLE_TABLE_FRAME_BORDER 8
|
||||
|
||||
// See nsStyleTable
|
||||
#define NS_STYLE_TABLE_RULES_NONE 0
|
||||
#define NS_STYLE_TABLE_RULES_GROUPS 1
|
||||
#define NS_STYLE_TABLE_RULES_ROWS 2
|
||||
#define NS_STYLE_TABLE_RULES_COLS 3
|
||||
#define NS_STYLE_TABLE_RULES_ALL 4
|
||||
|
||||
#define NS_STYLE_TABLE_COLS_NONE (-1)
|
||||
#define NS_STYLE_TABLE_COLS_ALL PRInt32(1 << 30)
|
||||
|
||||
#define NS_STYLE_TABLE_LAYOUT_AUTO 0
|
||||
#define NS_STYLE_TABLE_LAYOUT_FIXED 1
|
||||
|
||||
#define NS_STYLE_TABLE_EMPTY_CELLS_HIDE 0
|
||||
#define NS_STYLE_TABLE_EMPTY_CELLS_SHOW 1
|
||||
|
||||
// CAPTION_SIDE uses NS_SIDE_*
|
||||
|
||||
// constants for cell "scope" attribute
|
||||
#define NS_STYLE_CELL_SCOPE_ROW 0
|
||||
#define NS_STYLE_CELL_SCOPE_COL 1
|
||||
#define NS_STYLE_CELL_SCOPE_ROWGROUP 2
|
||||
#define NS_STYLE_CELL_SCOPE_COLGROUP 3
|
||||
|
||||
// See nsStylePage
|
||||
#define NS_STYLE_PAGE_MARKS_NONE 0x00
|
||||
#define NS_STYLE_PAGE_MARKS_CROP 0x01
|
||||
#define NS_STYLE_PAGE_MARKS_REGISTER 0x02
|
||||
|
||||
// See nsStylePage
|
||||
#define NS_STYLE_PAGE_SIZE_AUTO 0
|
||||
#define NS_STYLE_PAGE_SIZE_PORTRAIT 1
|
||||
#define NS_STYLE_PAGE_SIZE_LANDSCAPE 2
|
||||
|
||||
// See nsStyleBreaks
|
||||
#define NS_STYLE_PAGE_BREAK_AUTO 0
|
||||
#define NS_STYLE_PAGE_BREAK_ALWAYS 1
|
||||
#define NS_STYLE_PAGE_BREAK_AVOID 2
|
||||
#define NS_STYLE_PAGE_BREAK_LEFT 3
|
||||
#define NS_STYLE_PAGE_BREAK_RIGHT 4
|
||||
|
||||
#endif /* nsStyleConsts_h___ */
|
||||
55
mozilla/layout/base/public/nsStyleStruct.h
Normal file
55
mozilla/layout/base/public/nsStyleStruct.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- 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 nsStyleStruct_h___
|
||||
#define nsStyleStruct_h___
|
||||
|
||||
enum nsStyleStructID {
|
||||
eStyleStruct_Font = 1,
|
||||
eStyleStruct_Color = 2,
|
||||
eStyleStruct_List = 3,
|
||||
eStyleStruct_Position = 4,
|
||||
eStyleStruct_Text = 5,
|
||||
eStyleStruct_Display = 6,
|
||||
eStyleStruct_Table = 7,
|
||||
eStyleStruct_Content = 8,
|
||||
eStyleStruct_UserInterface = 9,
|
||||
eStyleStruct_Print = 10,
|
||||
eStyleStruct_Margin = 11,
|
||||
eStyleStruct_Padding = 12,
|
||||
eStyleStruct_Border = 13,
|
||||
eStyleStruct_Outline = 14,
|
||||
#ifdef INCLUDE_XUL
|
||||
eStyleStruct_XUL = 15,
|
||||
eStyleStruct_Max = eStyleStruct_XUL,
|
||||
eStyleStruct_BorderPaddingShortcut = 16 // only for use in GetStyle()
|
||||
#else
|
||||
eStyleStruct_Max = eStyleStruct_Outline,
|
||||
eStyleStruct_BorderPaddingShortcut = 15 // only for use in GetStyle()
|
||||
#endif
|
||||
};
|
||||
|
||||
struct nsStyleStruct {
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsStyleStruct_h___ */
|
||||
|
||||
38
mozilla/layout/base/public/nslayout.h
Normal file
38
mozilla/layout/base/public/nslayout.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/* -*- 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 nslayout_h___
|
||||
#define nslayout_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
|
||||
// Note: For now, NS_LAYOUT and NS_HTML are joined at the hip
|
||||
#if defined(_IMPL_NS_LAYOUT) || defined(_IMPL_NS_HTML)
|
||||
#define NS_LAYOUT NS_EXPORT
|
||||
#define NS_HTML NS_EXPORT
|
||||
#else
|
||||
#define NS_LAYOUT NS_IMPORT
|
||||
#define NS_HTML NS_IMPORT
|
||||
#endif
|
||||
|
||||
#endif /* nslayout_h___ */
|
||||
4
mozilla/layout/base/src/MANIFEST
Normal file
4
mozilla/layout/base/src/MANIFEST
Normal file
@@ -0,0 +1,4 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:layout directory
|
||||
#
|
||||
nsContentList.h
|
||||
72
mozilla/layout/base/src/Makefile.in
Normal file
72
mozilla/layout/base/src/Makefile.in
Normal file
@@ -0,0 +1,72 @@
|
||||
#
|
||||
# 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 = layout
|
||||
LIBRARY_NAME = gkbase_s
|
||||
REQUIRES = xpcom string dom widget view locale timer htmlparser webshell necko uconv pref uriloader gfx2
|
||||
|
||||
CPPSRCS = \
|
||||
nsAutoCopy.cpp \
|
||||
nsCaret.cpp \
|
||||
nsCopySupport.cpp \
|
||||
nsFrameImageLoader.cpp \
|
||||
nsFrameList.cpp \
|
||||
nsFrameTraversal.cpp \
|
||||
nsFrameUtil.cpp \
|
||||
nsGalleyContext.cpp \
|
||||
nsLayoutDebugger.cpp \
|
||||
nsPresContext.cpp \
|
||||
nsPresState.cpp \
|
||||
nsPrintContext.cpp \
|
||||
nsPrintPreviewContext.cpp \
|
||||
nsSpaceManager.cpp \
|
||||
nsStyleChangeList.cpp \
|
||||
nsLayoutHistoryState.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef IBMBIDI
|
||||
CPPSRCS += \
|
||||
nsBidiPresUtils.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
# 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
|
||||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
||||
|
||||
INCLUDES += \
|
||||
-I$(srcdir)/../../events/src \
|
||||
-I$(srcdir)/../../html/base/src \
|
||||
-I$(srcdir)/../../html/style/src \
|
||||
-I$(srcdir)/../../xul/base/src \
|
||||
-I$(srcdir)/../../xul/content/src \
|
||||
$(NULL)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user