зеркало из https://github.com/mozilla/gecko-dev.git
Backing out changes until I can figure out what's happening
This commit is contained in:
Родитель
d80673aca9
Коммит
e350b12f78
|
@ -6,13 +6,12 @@ extern "C" {
|
||||||
|
|
||||||
EXTERN_PROXY_FILE( ISimpleDOMDocument )
|
EXTERN_PROXY_FILE( ISimpleDOMDocument )
|
||||||
EXTERN_PROXY_FILE( ISimpleDOMNode )
|
EXTERN_PROXY_FILE( ISimpleDOMNode )
|
||||||
EXTERN_PROXY_FILE( ISimpleDOMText )
|
|
||||||
|
|
||||||
PROXYFILE_LIST_START
|
PROXYFILE_LIST_START
|
||||||
/* Start of list */
|
/* Start of list */
|
||||||
REFERENCE_PROXY_FILE( ISimpleDOMDocument ),
|
REFERENCE_PROXY_FILE( ISimpleDOMDocument ),
|
||||||
REFERENCE_PROXY_FILE( ISimpleDOMNode ),
|
REFERENCE_PROXY_FILE( ISimpleDOMNode ),
|
||||||
REFERENCE_PROXY_FILE( ISimpleDOMText ),
|
|
||||||
/* End of list */
|
/* End of list */
|
||||||
PROXYFILE_LIST_END
|
PROXYFILE_LIST_END
|
||||||
|
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public
|
|
||||||
* License Version 1.1 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS
|
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
||||||
* implied. See the License for the specific language governing
|
|
||||||
* rights and limitations under the License.
|
|
||||||
*
|
|
||||||
* The Original Code is the Mozilla browser.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is Netscape
|
|
||||||
* Communications Corporation. Portions created by Netscape are
|
|
||||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
|
||||||
* Rights Reserved.
|
|
||||||
*
|
|
||||||
* Original Author: Aaron Leventhal (aaronl@netscape.com)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
import "objidl.idl";
|
|
||||||
import "oaidl.idl";
|
|
||||||
|
|
||||||
[object, uuid(aa24e510-a4e6-4112-a258-0ba7f12e85a9)]
|
|
||||||
interface ISimpleDOMText: IUnknown
|
|
||||||
{
|
|
||||||
// Includes whitespace in DOM
|
|
||||||
[propget] HRESULT domText([out, retval] BSTR *domText);
|
|
||||||
|
|
||||||
HRESULT get_clippedSubstringBounds([in] unsigned int startIndex,
|
|
||||||
[in] unsigned int endIndex,
|
|
||||||
[out] int *x,
|
|
||||||
[out] int *y,
|
|
||||||
[out] int *width,
|
|
||||||
[out] int *height);
|
|
||||||
|
|
||||||
HRESULT get_unclippedSubstringBounds([in] unsigned int startIndex,
|
|
||||||
[in] unsigned int endIndex,
|
|
||||||
[out] int *x,
|
|
||||||
[out] int *y,
|
|
||||||
[out] int *width,
|
|
||||||
[out] int *height);
|
|
||||||
|
|
||||||
HRESULT scrollToSubstring([in] unsigned int startIndex,
|
|
||||||
[in] unsigned int endIndex);
|
|
||||||
};
|
|
||||||
|
|
|
@ -65,8 +65,6 @@ CSRCS = \
|
||||||
ISimpleDOMNode_i.c \
|
ISimpleDOMNode_i.c \
|
||||||
ISimpleDOMDocument_p.c \
|
ISimpleDOMDocument_p.c \
|
||||||
ISimpleDOMDocument_i.c \
|
ISimpleDOMDocument_i.c \
|
||||||
ISimpleDOMText_p.c \
|
|
||||||
ISimpleDOMText_i.c \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
MIDL_GENERATED_FILES = \
|
MIDL_GENERATED_FILES = \
|
||||||
|
@ -76,9 +74,6 @@ MIDL_GENERATED_FILES = \
|
||||||
ISimpleDOMDocument.h \
|
ISimpleDOMDocument.h \
|
||||||
ISimpleDOMDocument_p.c \
|
ISimpleDOMDocument_p.c \
|
||||||
ISimpleDOMDocument_i.c \
|
ISimpleDOMDocument_i.c \
|
||||||
ISimpleDOMText.h \
|
|
||||||
ISimpleDOMText_p.c \
|
|
||||||
ISimpleDOMText_i.c \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
SRCDIR_CSRCS = $(addprefix $(srcdir)/,$(CSRCS))
|
SRCDIR_CSRCS = $(addprefix $(srcdir)/,$(CSRCS))
|
||||||
|
@ -93,10 +88,9 @@ OS_LIBS = \
|
||||||
|
|
||||||
$(MIDL_GENERATED_FILES): done_gen
|
$(MIDL_GENERATED_FILES): done_gen
|
||||||
|
|
||||||
done_gen: ISimpleDOMNode.idl ISimpleDOMDocument.idl ISimpleDOMText.idl
|
done_gen: ISimpleDOMNode.idl ISimpleDOMDocument.idl
|
||||||
"$(MIDL)" $(srcdir)/ISimpleDOMNode.idl
|
"$(MIDL)" $(srcdir)/ISimpleDOMNode.idl
|
||||||
"$(MIDL)" $(srcdir)/ISimpleDOMDocument.idl
|
"$(MIDL)" $(srcdir)/ISimpleDOMDocument.idl
|
||||||
"$(MIDL)" $(srcdir)/ISimpleDOMText.idl
|
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
EXPORTS = \
|
EXPORTS = \
|
||||||
|
@ -104,8 +98,6 @@ EXPORTS = \
|
||||||
ISimpleDOMNode_i.c \
|
ISimpleDOMNode_i.c \
|
||||||
ISimpleDOMDocument.h \
|
ISimpleDOMDocument.h \
|
||||||
ISimpleDOMDocument_i.c \
|
ISimpleDOMDocument_i.c \
|
||||||
ISimpleDOMText.h \
|
|
||||||
ISimpleDOMText_i.c \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
export:: done_gen
|
export:: done_gen
|
||||||
|
|
|
@ -100,8 +100,6 @@ EXPORTS = \
|
||||||
nsAccessibleWrap.h \
|
nsAccessibleWrap.h \
|
||||||
nsDocAccessibleWrap.h \
|
nsDocAccessibleWrap.h \
|
||||||
nsRootAccessibleWrap.h \
|
nsRootAccessibleWrap.h \
|
||||||
nsTextAccessibleWrap.h \
|
|
||||||
nsAccessibleText.h \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# we want to force the creation of a static lib.
|
# we want to force the creation of a static lib.
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
// NOTE: alphabetically ordered
|
// NOTE: alphabetically ordered
|
||||||
#include "nsTextAccessibleWrap.h"
|
#include "nsAccessibleText.h"
|
||||||
#include "nsContentCID.h"
|
#include "nsContentCID.h"
|
||||||
#include "nsIAccessibleEventReceiver.h"
|
#include "nsIAccessibleEventReceiver.h"
|
||||||
#include "nsIClipboard.h"
|
#include "nsIClipboard.h"
|
||||||
|
@ -67,31 +67,29 @@
|
||||||
|
|
||||||
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
||||||
|
|
||||||
PRBool nsTextAccessibleWrap::gSuppressedNotifySelectionChanged = PR_FALSE;
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
// nsTextAccessibleWrap Accessible
|
// nsAccessibleText Accessible
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
PRBool nsAccessibleText::gSuppressedNotifySelectionChanged = PR_FALSE;
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_INHERITED1(nsTextAccessibleWrap, nsTextAccessible, nsIAccessibleText)
|
NS_IMPL_ISUPPORTS1(nsAccessibleText, nsIAccessibleText)
|
||||||
|
|
||||||
nsTextAccessibleWrap::nsTextAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
|
||||||
nsTextAccessible(aDOMNode, aShell)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nsTextAccessibleWrap implements the nsIAccessibleText interface for static text which mDOMNode
|
* nsAccessibleText implements the nsIAccessibleText interface for static text which mTextNode
|
||||||
* has nsITextContent interface
|
* has nsITextContent interface
|
||||||
*/
|
*/
|
||||||
|
nsAccessibleText::nsAccessibleText(nsIDOMNode *aNode)
|
||||||
|
{
|
||||||
|
mTextNode = aNode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nsIAccessibleText helpers
|
* nsIAccessibleText helpers
|
||||||
*/
|
*/
|
||||||
nsresult nsTextAccessibleWrap::GetSelections(nsISelectionController **aSelCon, nsISelection **aDomSel)
|
nsresult nsAccessibleText::GetSelections(nsISelectionController **aSelCon, nsISelection **aDomSel)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||||
mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
mTextNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
@ -99,7 +97,7 @@ nsresult nsTextAccessibleWrap::GetSelections(nsISelectionController **aSelCon, n
|
||||||
doc->GetShellAt(0, getter_AddRefs(shell));
|
doc->GetShellAt(0, getter_AddRefs(shell));
|
||||||
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
|
||||||
nsIFrame *frame = nsnull;
|
nsIFrame *frame = nsnull;
|
||||||
shell->GetPrimaryFrameFor(content, &frame);
|
shell->GetPrimaryFrameFor(content, &frame);
|
||||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||||
|
@ -133,7 +131,7 @@ nsresult nsTextAccessibleWrap::GetSelections(nsISelectionController **aSelCon, n
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsTextAccessibleWrap::DOMPointToOffset(nsISupports *aClosure, nsIDOMNode* aNode, PRInt32 aNodeOffset, PRInt32* aResult)
|
nsresult nsAccessibleText::DOMPointToOffset(nsISupports *aClosure, nsIDOMNode* aNode, PRInt32 aNodeOffset, PRInt32* aResult)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aNode && aResult);
|
NS_ENSURE_ARG_POINTER(aNode && aResult);
|
||||||
|
|
||||||
|
@ -229,7 +227,7 @@ nsresult nsTextAccessibleWrap::DOMPointToOffset(nsISupports *aClosure, nsIDOMNod
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsTextAccessibleWrap::OffsetToDOMPoint(nsISupports *aClosure, PRInt32 aOffset, nsIDOMNode** aResult, PRInt32* aPosition)
|
nsresult nsAccessibleText::OffsetToDOMPoint(nsISupports *aClosure, PRInt32 aOffset, nsIDOMNode** aResult, PRInt32* aPosition)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aResult && aPosition);
|
NS_ENSURE_ARG_POINTER(aResult && aPosition);
|
||||||
|
|
||||||
|
@ -321,7 +319,7 @@ nsresult nsTextAccessibleWrap::OffsetToDOMPoint(nsISupports *aClosure, PRInt32 a
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsTextAccessibleWrap::GetCurrectOffset(nsISupports *aClosure, nsISelection *aDomSel, PRInt32 *aOffset)
|
nsresult nsAccessibleText::GetCurrectOffset(nsISupports *aClosure, nsISelection *aDomSel, PRInt32 *aOffset)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMNode> focusNode;
|
nsCOMPtr<nsIDOMNode> focusNode;
|
||||||
aDomSel->GetFocusNode(getter_AddRefs(focusNode));
|
aDomSel->GetFocusNode(getter_AddRefs(focusNode));
|
||||||
|
@ -355,10 +353,10 @@ ATK_TEXT_BOUNDARY_LINE_START
|
||||||
ATK_TEXT_BOUNDARY_LINE_END
|
ATK_TEXT_BOUNDARY_LINE_END
|
||||||
The returned string is from the line end before/at/after the offset to the next line start.
|
The returned string is from the line end before/at/after the offset to the next line start.
|
||||||
*/
|
*/
|
||||||
nsresult nsTextAccessibleWrap::GetTextHelperCore(EGetTextType aType, nsTextAccessibleWrapBoundary aBoundaryType,
|
nsresult nsAccessibleText::GetTextHelperCore(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType,
|
||||||
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset,
|
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset,
|
||||||
nsISelectionController *aSelCon, nsISelection *aDomSel,
|
nsISelectionController *aSelCon, nsISelection *aDomSel,
|
||||||
nsISupports *aClosure, nsAString &aText)
|
nsISupports *aClosure, nsAString &aText)
|
||||||
{
|
{
|
||||||
PRInt32 rangeCount;
|
PRInt32 rangeCount;
|
||||||
nsCOMPtr<nsIDOMRange> range, oldRange;
|
nsCOMPtr<nsIDOMRange> range, oldRange;
|
||||||
|
@ -395,7 +393,7 @@ nsresult nsTextAccessibleWrap::GetTextHelperCore(EGetTextType aType, nsTextAcces
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The start/end focus node may be not our mDOMNode
|
// The start/end focus node may be not our mTextNode
|
||||||
nsCOMPtr<nsIDOMNode> startFocusNode, endFocusNode;
|
nsCOMPtr<nsIDOMNode> startFocusNode, endFocusNode;
|
||||||
switch (aBoundaryType)
|
switch (aBoundaryType)
|
||||||
{
|
{
|
||||||
|
@ -467,7 +465,7 @@ nsresult nsTextAccessibleWrap::GetTextHelperCore(EGetTextType aType, nsTextAcces
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsTextAccessibleWrap::GetTextHelper(EGetTextType aType, nsTextAccessibleWrapBoundary aBoundaryType,
|
nsresult nsAccessibleText::GetTextHelper(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType,
|
||||||
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset,
|
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset,
|
||||||
nsISupports *aClosure, nsAString &aText)
|
nsISupports *aClosure, nsAString &aText)
|
||||||
{
|
{
|
||||||
|
@ -515,7 +513,7 @@ nsresult nsTextAccessibleWrap::GetTextHelper(EGetTextType aType, nsTextAccessibl
|
||||||
/*
|
/*
|
||||||
* Gets the offset position of the caret (cursor).
|
* Gets the offset position of the caret (cursor).
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetCaretOffset(PRInt32 *aCaretOffset)
|
NS_IMETHODIMP nsAccessibleText::GetCaretOffset(PRInt32 *aCaretOffset)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISelection> domSel;
|
nsCOMPtr<nsISelection> domSel;
|
||||||
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
||||||
|
@ -523,7 +521,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetCaretOffset(PRInt32 *aCaretOffset)
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> focusNode;
|
nsCOMPtr<nsIDOMNode> focusNode;
|
||||||
domSel->GetFocusNode(getter_AddRefs(focusNode));
|
domSel->GetFocusNode(getter_AddRefs(focusNode));
|
||||||
if (focusNode != mDOMNode)
|
if (focusNode != mTextNode)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
return domSel->GetFocusOffset(aCaretOffset);
|
return domSel->GetFocusOffset(aCaretOffset);
|
||||||
|
@ -532,7 +530,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetCaretOffset(PRInt32 *aCaretOffset)
|
||||||
/*
|
/*
|
||||||
* Sets the caret (cursor) position to the specified offset.
|
* Sets the caret (cursor) position to the specified offset.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::SetCaretOffset(PRInt32 aCaretOffset)
|
NS_IMETHODIMP nsAccessibleText::SetCaretOffset(PRInt32 aCaretOffset)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISelection> domSel;
|
nsCOMPtr<nsISelection> domSel;
|
||||||
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
||||||
|
@ -541,8 +539,8 @@ NS_IMETHODIMP nsTextAccessibleWrap::SetCaretOffset(PRInt32 aCaretOffset)
|
||||||
nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID));
|
nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID));
|
||||||
NS_ENSURE_TRUE(range, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(range, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
range->SetStart(mDOMNode, aCaretOffset);
|
range->SetStart(mTextNode, aCaretOffset);
|
||||||
range->SetEnd(mDOMNode, aCaretOffset);
|
range->SetEnd(mTextNode, aCaretOffset);
|
||||||
domSel->RemoveAllRanges();
|
domSel->RemoveAllRanges();
|
||||||
return domSel->AddRange(range);
|
return domSel->AddRange(range);
|
||||||
}
|
}
|
||||||
|
@ -550,9 +548,9 @@ NS_IMETHODIMP nsTextAccessibleWrap::SetCaretOffset(PRInt32 aCaretOffset)
|
||||||
/*
|
/*
|
||||||
* Gets the character count.
|
* Gets the character count.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterCount(PRInt32 *aCharacterCount)
|
NS_IMETHODIMP nsAccessibleText::GetCharacterCount(PRInt32 *aCharacterCount)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsITextContent> textContent(do_QueryInterface(mDOMNode));
|
nsCOMPtr<nsITextContent> textContent(do_QueryInterface(mTextNode));
|
||||||
if (!textContent)
|
if (!textContent)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
@ -562,7 +560,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterCount(PRInt32 *aCharacterCount)
|
||||||
/*
|
/*
|
||||||
* Gets the number of selected regions.
|
* Gets the number of selected regions.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetSelectionCount(PRInt32 *aSelectionCount)
|
NS_IMETHODIMP nsAccessibleText::GetSelectionCount(PRInt32 *aSelectionCount)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISelection> domSel;
|
nsCOMPtr<nsISelection> domSel;
|
||||||
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
||||||
|
@ -584,27 +582,27 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetSelectionCount(PRInt32 *aSelectionCount)
|
||||||
/*
|
/*
|
||||||
* Gets the specified text.
|
* Gets the specified text.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset, nsAString &aText)
|
NS_IMETHODIMP nsAccessibleText::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset, nsAString &aText)
|
||||||
{
|
{
|
||||||
nsAutoString text;
|
nsAutoString text;
|
||||||
mDOMNode->GetNodeValue(text);
|
mTextNode->GetNodeValue(text);
|
||||||
aText = Substring(text, aStartOffset, aEndOffset - aStartOffset);
|
aText = Substring(text, aStartOffset, aEndOffset - aStartOffset);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetTextBeforeOffset(PRInt32 aOffset, nsTextAccessibleWrapBoundary aBoundaryType,
|
NS_IMETHODIMP nsAccessibleText::GetTextBeforeOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
|
||||||
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
||||||
{
|
{
|
||||||
return GetTextHelper(eGetBefore, aBoundaryType, aOffset, aStartOffset, aEndOffset, nsnull, aText);
|
return GetTextHelper(eGetBefore, aBoundaryType, aOffset, aStartOffset, aEndOffset, nsnull, aText);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetTextAtOffset(PRInt32 aOffset, nsTextAccessibleWrapBoundary aBoundaryType,
|
NS_IMETHODIMP nsAccessibleText::GetTextAtOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
|
||||||
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
||||||
{
|
{
|
||||||
return GetTextHelper(eGetAt, aBoundaryType, aOffset, aStartOffset, aEndOffset, nsnull, aText);
|
return GetTextHelper(eGetAt, aBoundaryType, aOffset, aStartOffset, aEndOffset, nsnull, aText);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetTextAfterOffset(PRInt32 aOffset, nsTextAccessibleWrapBoundary aBoundaryType,
|
NS_IMETHODIMP nsAccessibleText::GetTextAfterOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
|
||||||
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
||||||
{
|
{
|
||||||
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, nsnull, aText);
|
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, nsnull, aText);
|
||||||
|
@ -613,7 +611,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetTextAfterOffset(PRInt32 aOffset, nsTextAc
|
||||||
/*
|
/*
|
||||||
* Gets the specified text.
|
* Gets the specified text.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar *aCharacter)
|
NS_IMETHODIMP nsAccessibleText::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar *aCharacter)
|
||||||
{
|
{
|
||||||
nsAutoString text;
|
nsAutoString text;
|
||||||
nsresult rv = GetText(aOffset, aOffset + 1, text);
|
nsresult rv = GetText(aOffset, aOffset + 1, text);
|
||||||
|
@ -622,7 +620,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterAtOffset(PRInt32 aOffset, PRUnic
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetAttributeRange(PRInt32 aOffset, PRInt32 *aRangeStartOffset,
|
NS_IMETHODIMP nsAccessibleText::GetAttributeRange(PRInt32 aOffset, PRInt32 *aRangeStartOffset,
|
||||||
PRInt32 *aRangeEndOffset, nsISupports **aAttribute)
|
PRInt32 *aRangeEndOffset, nsISupports **aAttribute)
|
||||||
{
|
{
|
||||||
// will do better job later
|
// will do better job later
|
||||||
|
@ -635,12 +633,12 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetAttributeRange(PRInt32 aOffset, PRInt32 *
|
||||||
/*
|
/*
|
||||||
* Given an offset, the x, y, width, and height values are filled appropriately.
|
* Given an offset, the x, y, width, and height values are filled appropriately.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aOffset,
|
NS_IMETHODIMP nsAccessibleText::GetCharacterExtents(PRInt32 aOffset,
|
||||||
PRInt32 *aX, PRInt32 *aY, PRInt32 *aWidth, PRInt32 *aHeight,
|
PRInt32 *aX, PRInt32 *aY, PRInt32 *aWidth, PRInt32 *aHeight,
|
||||||
nsAccessibleCoordType aCoordType)
|
nsAccessibleCoordType aCoordType)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||||
mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
mTextNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
@ -652,7 +650,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aOffset,
|
||||||
shell->GetPresContext(getter_AddRefs(context));
|
shell->GetPresContext(getter_AddRefs(context));
|
||||||
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
|
||||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsIFrame *frame = nsnull;
|
nsIFrame *frame = nsnull;
|
||||||
|
@ -779,7 +777,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aOffset,
|
||||||
* Gets the offset of the character located at coordinates x and y. x and y are interpreted as being relative to
|
* Gets the offset of the character located at coordinates x and y. x and y are interpreted as being relative to
|
||||||
* the screen or this widget's window depending on coords.
|
* the screen or this widget's window depending on coords.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY, nsAccessibleCoordType aCoordType, PRInt32 *aOffset)
|
NS_IMETHODIMP nsAccessibleText::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY, nsAccessibleCoordType aCoordType, PRInt32 *aOffset)
|
||||||
{
|
{
|
||||||
// will do better job later
|
// will do better job later
|
||||||
*aOffset = 0;
|
*aOffset = 0;
|
||||||
|
@ -789,7 +787,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY, nsA
|
||||||
/*
|
/*
|
||||||
* Gets the start and end offset of the specified selection.
|
* Gets the start and end offset of the specified selection.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::GetSelectionBounds(PRInt32 aSelectionNum, PRInt32 *aStartOffset, PRInt32 *aEndOffset)
|
NS_IMETHODIMP nsAccessibleText::GetSelectionBounds(PRInt32 aSelectionNum, PRInt32 *aStartOffset, PRInt32 *aEndOffset)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISelection> domSel;
|
nsCOMPtr<nsISelection> domSel;
|
||||||
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
||||||
|
@ -810,7 +808,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetSelectionBounds(PRInt32 aSelectionNum, PR
|
||||||
/*
|
/*
|
||||||
* Changes the start and end offset of the specified selection.
|
* Changes the start and end offset of the specified selection.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::SetSelectionBounds(PRInt32 aSelectionNum, PRInt32 aStartOffset, PRInt32 aEndOffset)
|
NS_IMETHODIMP nsAccessibleText::SetSelectionBounds(PRInt32 aSelectionNum, PRInt32 aStartOffset, PRInt32 aEndOffset)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISelection> domSel;
|
nsCOMPtr<nsISelection> domSel;
|
||||||
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
||||||
|
@ -845,7 +843,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::SetSelectionBounds(PRInt32 aSelectionNum, PR
|
||||||
/*
|
/*
|
||||||
* Adds a selection bounded by the specified offsets.
|
* Adds a selection bounded by the specified offsets.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
|
NS_IMETHODIMP nsAccessibleText::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISelectionController> selCon;
|
nsCOMPtr<nsISelectionController> selCon;
|
||||||
nsCOMPtr<nsISelection> domSel;
|
nsCOMPtr<nsISelection> domSel;
|
||||||
|
@ -857,15 +855,15 @@ NS_IMETHODIMP nsTextAccessibleWrap::AddSelection(PRInt32 aStartOffset, PRInt32 a
|
||||||
if (! range)
|
if (! range)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
range->SetStart(mDOMNode, aStartOffset);
|
range->SetStart(mTextNode, aStartOffset);
|
||||||
range->SetEnd(mDOMNode, aEndOffset);
|
range->SetEnd(mTextNode, aEndOffset);
|
||||||
return domSel->AddRange(range);
|
return domSel->AddRange(range);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Removes the specified selection.
|
* Removes the specified selection.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsTextAccessibleWrap::RemoveSelection(PRInt32 aSelectionNum)
|
NS_IMETHODIMP nsAccessibleText::RemoveSelection(PRInt32 aSelectionNum)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISelection> domSel;
|
nsCOMPtr<nsISelection> domSel;
|
||||||
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel));
|
||||||
|
@ -891,7 +889,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::RemoveSelection(PRInt32 aSelectionNum)
|
||||||
NS_IMPL_ISUPPORTS3(nsAccessibleEditableText, nsIAccessibleText, nsIAccessibleEditableText, nsIEditActionListener)
|
NS_IMPL_ISUPPORTS3(nsAccessibleEditableText, nsIAccessibleText, nsIAccessibleEditableText, nsIEditActionListener)
|
||||||
|
|
||||||
nsAccessibleEditableText::nsAccessibleEditableText(nsIDOMNode *aNode):
|
nsAccessibleEditableText::nsAccessibleEditableText(nsIDOMNode *aNode):
|
||||||
nsTextAccessibleWrap(aNode)
|
nsAccessibleText(aNode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -936,7 +934,7 @@ nsresult nsAccessibleEditableText::FireTextChangeEvent(AtkTextChange *aTextData)
|
||||||
nsITextControlFrame* nsAccessibleEditableText::GetTextFrame()
|
nsITextControlFrame* nsAccessibleEditableText::GetTextFrame()
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||||
mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
mTextNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||||
NS_ENSURE_TRUE(doc, nsnull);
|
NS_ENSURE_TRUE(doc, nsnull);
|
||||||
|
|
||||||
|
@ -944,7 +942,7 @@ nsITextControlFrame* nsAccessibleEditableText::GetTextFrame()
|
||||||
doc->GetShellAt(0, getter_AddRefs(shell));
|
doc->GetShellAt(0, getter_AddRefs(shell));
|
||||||
NS_ENSURE_TRUE(shell, nsnull);
|
NS_ENSURE_TRUE(shell, nsnull);
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
|
||||||
nsIFrame *frame = nsnull;
|
nsIFrame *frame = nsnull;
|
||||||
shell->GetPrimaryFrameFor(content, &frame);
|
shell->GetPrimaryFrameFor(content, &frame);
|
||||||
NS_ENSURE_TRUE(frame, nsnull);
|
NS_ENSURE_TRUE(frame, nsnull);
|
||||||
|
@ -1052,19 +1050,19 @@ NS_IMETHODIMP nsAccessibleEditableText::GetText(PRInt32 aStartOffset, PRInt32 aE
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsAccessibleEditableText::GetTextBeforeOffset(PRInt32 aOffset, nsTextAccessibleWrapBoundary aBoundaryType,
|
NS_IMETHODIMP nsAccessibleEditableText::GetTextBeforeOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
|
||||||
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
||||||
{
|
{
|
||||||
return GetTextHelper(eGetBefore, aBoundaryType, aOffset, aStartOffset, aEndOffset, mEditor, aText);
|
return GetTextHelper(eGetBefore, aBoundaryType, aOffset, aStartOffset, aEndOffset, mEditor, aText);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsAccessibleEditableText::GetTextAtOffset(PRInt32 aOffset, nsTextAccessibleWrapBoundary aBoundaryType,
|
NS_IMETHODIMP nsAccessibleEditableText::GetTextAtOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
|
||||||
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
||||||
{
|
{
|
||||||
return GetTextHelper(eGetAt, aBoundaryType, aOffset, aStartOffset, aEndOffset, mEditor, aText);
|
return GetTextHelper(eGetAt, aBoundaryType, aOffset, aStartOffset, aEndOffset, mEditor, aText);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsAccessibleEditableText::GetTextAfterOffset(PRInt32 aOffset, nsTextAccessibleWrapBoundary aBoundaryType,
|
NS_IMETHODIMP nsAccessibleEditableText::GetTextAfterOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
|
||||||
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
|
||||||
{
|
{
|
||||||
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, mEditor, aText);
|
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, mEditor, aText);
|
||||||
|
@ -1080,11 +1078,11 @@ NS_IMETHODIMP nsAccessibleEditableText::SetAttributes(PRInt32 aStartPos, PRInt32
|
||||||
|
|
||||||
NS_IMETHODIMP nsAccessibleEditableText::SetTextContents(const nsAString &aText)
|
NS_IMETHODIMP nsAccessibleEditableText::SetTextContents(const nsAString &aText)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mTextNode));
|
||||||
if (textArea)
|
if (textArea)
|
||||||
return textArea->SetValue(aText);
|
return textArea->SetValue(aText);
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mTextNode));
|
||||||
if (inputElement)
|
if (inputElement)
|
||||||
return inputElement->SetValue(aText);
|
return inputElement->SetValue(aText);
|
||||||
|
|
||||||
|
@ -1265,3 +1263,12 @@ NS_IMETHODIMP nsAccessibleEditableText::DidDeleteSelection(nsISelection *aSelect
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------
|
||||||
|
// nsTextAccessibleWrap Accessible
|
||||||
|
// --------------------------------------------------------
|
||||||
|
NS_IMPL_ISUPPORTS_INHERITED1(nsTextAccessibleWrap, nsTextAccessible, nsAccessibleText)
|
||||||
|
|
||||||
|
nsTextAccessibleWrap::nsTextAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||||
|
nsTextAccessible(aDOMNode, aShell), nsAccessibleText(aDOMNode)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include "nsIEditor.h"
|
#include "nsIEditor.h"
|
||||||
#include "nsISelectionController.h"
|
#include "nsISelectionController.h"
|
||||||
#include "nsITextControlFrame.h"
|
#include "nsITextControlFrame.h"
|
||||||
#include "nsTextAccessibleWrap.h"
|
|
||||||
#include "nsTextAccessible.h"
|
#include "nsTextAccessible.h"
|
||||||
|
|
||||||
enum EGetTextType { eGetBefore=-1, eGetAt=0, eGetAfter=1 };
|
enum EGetTextType { eGetBefore=-1, eGetAt=0, eGetAfter=1 };
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* 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 Corp.
|
|
||||||
* Portions created by Netscape Corp.are Copyright (C) 2003 Netscape
|
|
||||||
* Corp. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Original Author: Aaron Leventhal
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the NPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef _nsTextAccessibleWrap_H_
|
|
||||||
#define _nsTextAccessibleWrap_H_
|
|
||||||
|
|
||||||
#include "nsTextAccessible.h"
|
|
||||||
#include "nsAccessibleText.h"
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -98,16 +98,15 @@ nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell)
|
||||||
nsCOMPtr<nsIViewManager> vm;
|
nsCOMPtr<nsIViewManager> vm;
|
||||||
shell->GetViewManager(getter_AddRefs(vm));
|
shell->GetViewManager(getter_AddRefs(vm));
|
||||||
nsCOMPtr<nsIWidget> widget;
|
nsCOMPtr<nsIWidget> widget;
|
||||||
if (vm) {
|
vm->GetWidget(getter_AddRefs(widget));
|
||||||
vm->GetWidget(getter_AddRefs(widget));
|
mWnd = widget->GetNativeData(NS_NATIVE_WINDOW);
|
||||||
if (widget) {
|
|
||||||
mWnd = widget->GetNativeData(NS_NATIVE_WINDOW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ASSERTION(gGlobalDocAccessibleCache, "No global doc accessible cache");
|
NS_ASSERTION(gGlobalDocAccessibleCache, "No global doc accessible cache");
|
||||||
PutCacheEntry(gGlobalDocAccessibleCache, mWeakShell, this);
|
PutCacheEntry(gGlobalDocAccessibleCache, mWeakShell, this);
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("\nATTENTION: New doc accessible for weak shell %x\n", mWeakShell.get());
|
||||||
|
#endif
|
||||||
|
|
||||||
// XXX aaronl should we use an algorithm for the initial cache size?
|
// XXX aaronl should we use an algorithm for the initial cache size?
|
||||||
#ifdef OLD_HASH
|
#ifdef OLD_HASH
|
||||||
|
@ -409,52 +408,10 @@ nsIFrame* nsDocAccessible::GetFrame()
|
||||||
void nsDocAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
void nsDocAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||||
{
|
{
|
||||||
*aRelativeFrame = GetFrame();
|
*aRelativeFrame = GetFrame();
|
||||||
|
if (*aRelativeFrame)
|
||||||
nsCOMPtr<nsIDocument> document(mDocument);
|
(*aRelativeFrame)->GetRect(aBounds);
|
||||||
nsRect viewBounds;
|
|
||||||
nsCOMPtr<nsIViewManager> vm;
|
|
||||||
nsCOMPtr<nsIDocument> parentDoc;
|
|
||||||
|
|
||||||
while (document) {
|
|
||||||
nsCOMPtr<nsIPresShell> presShell;
|
|
||||||
document->GetShellAt(0, getter_AddRefs(presShell));
|
|
||||||
if (!presShell) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
presShell->GetViewManager(getter_AddRefs(vm));
|
|
||||||
|
|
||||||
nsIScrollableView* scrollableView = nsnull;
|
|
||||||
if (vm)
|
|
||||||
vm->GetRootScrollableView(&scrollableView);
|
|
||||||
|
|
||||||
if (scrollableView) {
|
|
||||||
const nsIView *view = nsnull;
|
|
||||||
scrollableView->GetClipView(&view);
|
|
||||||
if (view) {
|
|
||||||
view->GetBounds(viewBounds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nsIView *view;
|
|
||||||
vm->GetRootView(view);
|
|
||||||
if (view) {
|
|
||||||
view->GetBounds(viewBounds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parentDoc) { // After first time thru loop
|
|
||||||
aBounds.IntersectRect(viewBounds, aBounds);
|
|
||||||
}
|
|
||||||
else { // First time through loop
|
|
||||||
aBounds = viewBounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
document->GetParentDocument(getter_AddRefs(parentDoc));
|
|
||||||
document = parentDoc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nsDocAccessible::AddContentDocListeners()
|
void nsDocAccessible::AddContentDocListeners()
|
||||||
{
|
{
|
||||||
// 1) Set up scroll position listener
|
// 1) Set up scroll position listener
|
||||||
|
|
|
@ -82,8 +82,3 @@ NS_IMETHODIMP nsOuterDocAccessible::GetAccState(PRUint32 *aAccState)
|
||||||
return nsAccessible::GetAccState(aAccState);
|
return nsAccessible::GetAccState(aAccState);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsOuterDocAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y,
|
|
||||||
PRInt32 *width, PRInt32 *height)
|
|
||||||
{
|
|
||||||
return mFirstChild? mFirstChild->AccGetBounds(x, y, width, height): NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -57,8 +57,6 @@ class nsOuterDocAccessible : public nsBlockAccessible
|
||||||
NS_IMETHOD GetAccValue(nsAString& AccValue);
|
NS_IMETHOD GetAccValue(nsAString& AccValue);
|
||||||
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
|
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
|
||||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y,
|
|
||||||
PRInt32 *width, PRInt32 *height);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#include "nsISelectionController.h"
|
#include "nsISelectionController.h"
|
||||||
|
|
||||||
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||||
nsTextAccessibleWrap(aDomNode, aShell)
|
nsTextAccessible(aDomNode, aShell)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,11 @@
|
||||||
#ifndef _nsHTMLTextAccessible_H_
|
#ifndef _nsHTMLTextAccessible_H_
|
||||||
#define _nsHTMLTextAccessible_H_
|
#define _nsHTMLTextAccessible_H_
|
||||||
|
|
||||||
#include "nsTextAccessibleWrap.h"
|
#include "nsTextAccessible.h"
|
||||||
|
|
||||||
class nsIWeakReference;
|
class nsIWeakReference;
|
||||||
|
|
||||||
class nsHTMLTextAccessible : public nsTextAccessibleWrap
|
class nsHTMLTextAccessible : public nsTextAccessible
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* 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 Corp.
|
|
||||||
* Portions created by Netscape Corp.are Copyright (C) 2003 Netscape
|
|
||||||
* Corp. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Original Author: Aaron Leventhal
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the NPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef _nsTextAccessibleWrap_H_
|
|
||||||
#define _nsTextAccessibleWrap_H_
|
|
||||||
|
|
||||||
typedef class nsTextAccessible nsTextAccessibleWrap;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -67,7 +67,6 @@ REQUIRES = content \
|
||||||
CPPSRCS = \
|
CPPSRCS = \
|
||||||
nsAccessNodeWrap.cpp \
|
nsAccessNodeWrap.cpp \
|
||||||
nsAccessibleWrap.cpp \
|
nsAccessibleWrap.cpp \
|
||||||
nsTextAccessibleWrap.cpp \
|
|
||||||
nsDocAccessibleWrap.cpp \
|
nsDocAccessibleWrap.cpp \
|
||||||
nsRootAccessibleWrap.cpp \
|
nsRootAccessibleWrap.cpp \
|
||||||
nsHTMLWin32ObjectAccessible.cpp \
|
nsHTMLWin32ObjectAccessible.cpp \
|
||||||
|
@ -76,7 +75,6 @@ CPPSRCS = \
|
||||||
EXPORTS = \
|
EXPORTS = \
|
||||||
nsAccessNodeWrap.h \
|
nsAccessNodeWrap.h \
|
||||||
nsAccessibleWrap.h \
|
nsAccessibleWrap.h \
|
||||||
nsTextAccessibleWrap.h \
|
|
||||||
nsDocAccessibleWrap.h \
|
nsDocAccessibleWrap.h \
|
||||||
nsRootAccessibleWrap.h \
|
nsRootAccessibleWrap.h \
|
||||||
nsHTMLWin32ObjectAccessible.h \
|
nsHTMLWin32ObjectAccessible.h \
|
||||||
|
|
|
@ -138,12 +138,10 @@ STDMETHODIMP nsDocAccessibleWrap::get_accChild(
|
||||||
getter_AddRefs(parentDocAccessible));
|
getter_AddRefs(parentDocAccessible));
|
||||||
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(parentDocAccessible));
|
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(parentDocAccessible));
|
||||||
IAccessible *msaaParentDoc;
|
IAccessible *msaaParentDoc;
|
||||||
if (accessible) {
|
accessible->GetNativeInterface((void**)&msaaParentDoc);
|
||||||
accessible->GetNativeInterface((void**)&msaaParentDoc);
|
HRESULT rv = msaaParentDoc->get_accChild(varChild, ppdispChild);
|
||||||
HRESULT rv = msaaParentDoc->get_accChild(varChild, ppdispChild);
|
msaaParentDoc->Release();
|
||||||
msaaParentDoc->Release();
|
return rv;
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,262 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* 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 Corp.
|
|
||||||
* Portions created by Netscape Corp.are Copyright (C) 2003 Netscape
|
|
||||||
* Corp. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Original Author: Aaron Leventhal
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the NPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
// NOTE: alphabetically ordered
|
|
||||||
#include "nsTextAccessibleWrap.h"
|
|
||||||
#include "ISimpleDOMText_i.c"
|
|
||||||
#include "nsContentCID.h"
|
|
||||||
#include "nsIDOMRange.h"
|
|
||||||
#include "nsIFrame.h"
|
|
||||||
#include "nsIPresContext.h"
|
|
||||||
#include "nsIPresShell.h"
|
|
||||||
#include "nsIRenderingContext.h"
|
|
||||||
#include "nsISelection.h"
|
|
||||||
#include "nsISelectionController.h"
|
|
||||||
#include "nsIViewManager.h"
|
|
||||||
#include "nsIWidget.h"
|
|
||||||
|
|
||||||
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
|
||||||
// nsTextAccessibleWrap Accessible
|
|
||||||
// --------------------------------------------------------
|
|
||||||
|
|
||||||
nsTextAccessibleWrap::nsTextAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
|
||||||
nsTextAccessible(aDOMNode, aShell)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP_(ULONG) nsTextAccessibleWrap::AddRef()
|
|
||||||
{
|
|
||||||
return nsAccessNode::AddRef();
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP_(ULONG) nsTextAccessibleWrap::Release()
|
|
||||||
{
|
|
||||||
return nsAccessNode::Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP nsTextAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
|
|
||||||
{
|
|
||||||
*ppv = nsnull;
|
|
||||||
|
|
||||||
if (IID_IUnknown == iid || IID_ISimpleDOMText == iid)
|
|
||||||
*ppv = NS_STATIC_CAST(ISimpleDOMText*, this);
|
|
||||||
|
|
||||||
if (nsnull == *ppv)
|
|
||||||
return nsAccessibleWrap::QueryInterface(iid, ppv);
|
|
||||||
|
|
||||||
(NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP nsTextAccessibleWrap::get_domText(
|
|
||||||
/* [retval][out] */ BSTR __RPC_FAR *aDomText)
|
|
||||||
{
|
|
||||||
nsAutoString nodeValue;
|
|
||||||
|
|
||||||
mDOMNode->GetNodeValue(nodeValue);
|
|
||||||
*aDomText = ::SysAllocString(nodeValue.get());
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP nsTextAccessibleWrap::get_clippedSubstringBounds(
|
|
||||||
/* [in] */ unsigned int aStartIndex,
|
|
||||||
/* [in] */ unsigned int aEndIndex,
|
|
||||||
/* [out] */ int __RPC_FAR *aX,
|
|
||||||
/* [out] */ int __RPC_FAR *aY,
|
|
||||||
/* [out] */ int __RPC_FAR *aWidth,
|
|
||||||
/* [out] */ int __RPC_FAR *aHeight)
|
|
||||||
{
|
|
||||||
nscoord x, y, width, height, docX, docY, docWidth, docHeight;
|
|
||||||
get_unclippedSubstringBounds(aStartIndex, aEndIndex, &x, &y, &width, &height);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
|
||||||
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(docAccessible));
|
|
||||||
NS_ASSERTION(accessible, "There must always be a doc accessible, but there isn't");
|
|
||||||
|
|
||||||
accessible->AccGetBounds(&docX, &docY, &docWidth, &docHeight);
|
|
||||||
|
|
||||||
nsRect unclippedRect(x, y, width, height);
|
|
||||||
nsRect docRect(docX, docY, docWidth, docHeight);
|
|
||||||
nsRect clippedRect;
|
|
||||||
|
|
||||||
clippedRect.IntersectRect(unclippedRect, docRect);
|
|
||||||
|
|
||||||
*aX = clippedRect.x;
|
|
||||||
*aY = clippedRect.y;
|
|
||||||
*aWidth = clippedRect.width;
|
|
||||||
*aHeight = clippedRect.height;
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP nsTextAccessibleWrap::get_unclippedSubstringBounds(
|
|
||||||
/* [in] */ unsigned int aStartIndex,
|
|
||||||
/* [in] */ unsigned int aEndIndex,
|
|
||||||
/* [out] */ int __RPC_FAR *aX,
|
|
||||||
/* [out] */ int __RPC_FAR *aY,
|
|
||||||
/* [out] */ int __RPC_FAR *aWidth,
|
|
||||||
/* [out] */ int __RPC_FAR *aHeight)
|
|
||||||
{
|
|
||||||
if (NS_FAILED(GetCharacterExtents(aStartIndex, aEndIndex,
|
|
||||||
aX, aY, aWidth, aHeight))) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add offsets for entire accessible
|
|
||||||
PRInt32 nodeX, nodeY, nodeWidth, nodeHeight;
|
|
||||||
AccGetBounds(&nodeX, &nodeY, &nodeWidth, &nodeHeight);
|
|
||||||
*aX += nodeX;
|
|
||||||
*aY += nodeY;
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
STDMETHODIMP nsTextAccessibleWrap::scrollToSubstring(
|
|
||||||
/* [in] */ unsigned int aStartIndex,
|
|
||||||
/* [in] */ unsigned int aEndIndex)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIPresShell> presShell(GetPresShell());
|
|
||||||
nsIFrame *frame = GetFrame();
|
|
||||||
|
|
||||||
if (!frame || !presShell) {
|
|
||||||
return E_FAIL; // This accessible has been shut down
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIPresContext> presContext;
|
|
||||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
|
||||||
nsCOMPtr<nsIDOMRange> scrollToRange = do_CreateInstance(kRangeCID);
|
|
||||||
nsCOMPtr<nsISelectionController> selCon;
|
|
||||||
frame->GetSelectionController(presContext, getter_AddRefs(selCon));
|
|
||||||
if (!presContext || !scrollToRange || !selCon) {
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollToRange->SetStart(mDOMNode, aStartIndex);
|
|
||||||
scrollToRange->SetEnd(mDOMNode, aEndIndex);
|
|
||||||
nsCOMPtr<nsISelection> domSel;
|
|
||||||
selCon->GetSelection(nsISelectionController::SELECTION_ACCESSIBILITY,
|
|
||||||
getter_AddRefs(domSel));
|
|
||||||
if (domSel) {
|
|
||||||
domSel->RemoveAllRanges();
|
|
||||||
domSel->AddRange(scrollToRange);
|
|
||||||
|
|
||||||
selCon->ScrollSelectionIntoView(nsISelectionController::SELECTION_ACCESSIBILITY,
|
|
||||||
nsISelectionController::SELECTION_ANCHOR_REGION, PR_TRUE);
|
|
||||||
|
|
||||||
domSel->CollapseToStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIFrame* nsTextAccessibleWrap::GetPointFromOffset(nsIFrame *aContainingFrame,
|
|
||||||
nsIPresContext *aPresContext,
|
|
||||||
nsIRenderingContext *aRendContext,
|
|
||||||
PRInt32 aOffset,
|
|
||||||
nsPoint& aOutPoint)
|
|
||||||
{
|
|
||||||
nsIFrame *textFrame = nsnull;
|
|
||||||
PRInt32 outOffset;
|
|
||||||
aContainingFrame->GetChildFrameContainingOffset(aOffset, PR_FALSE, &outOffset, &textFrame);
|
|
||||||
if (!textFrame) {
|
|
||||||
return nsnull;
|
|
||||||
}
|
|
||||||
|
|
||||||
textFrame->GetPointFromOffset(aPresContext, aRendContext, aOffset, &aOutPoint);
|
|
||||||
return textFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Given an offset, the x, y, width, and height values are filled appropriately.
|
|
||||||
*/
|
|
||||||
nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32 aEndOffset,
|
|
||||||
PRInt32* aX, PRInt32* aY,
|
|
||||||
PRInt32* aWidth, PRInt32* aHeight)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIPresShell> presShell(GetPresShell());
|
|
||||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIPresContext> presContext;
|
|
||||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
|
||||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
|
||||||
float t2p;
|
|
||||||
if (NS_FAILED(presContext->GetTwipsToPixels(&t2p))) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIFrame *frame = nsnull;
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
|
||||||
presShell->GetPrimaryFrameFor(content, &frame);
|
|
||||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIViewManager> viewManager;
|
|
||||||
presShell->GetViewManager(getter_AddRefs(viewManager));
|
|
||||||
NS_ASSERTION(viewManager, "No view manager for pres shell");
|
|
||||||
|
|
||||||
nsCOMPtr<nsIWidget> widget;
|
|
||||||
viewManager->GetWidget(getter_AddRefs(widget));
|
|
||||||
|
|
||||||
nsIRenderingContext *rendContext;
|
|
||||||
rendContext = widget->GetRenderingContext();
|
|
||||||
|
|
||||||
nsPoint startPoint, endPoint;
|
|
||||||
nsIFrame *startFrame = GetPointFromOffset(frame, presContext, rendContext,
|
|
||||||
aStartOffset, startPoint);
|
|
||||||
nsIFrame *endFrame = GetPointFromOffset(frame, presContext, rendContext,
|
|
||||||
aEndOffset, endPoint);
|
|
||||||
if (!startFrame || !endFrame) {
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsRect startRect, endRect;
|
|
||||||
startFrame->GetRect(startRect);
|
|
||||||
endFrame->GetRect(endRect);
|
|
||||||
|
|
||||||
*aX = NSTwipsToIntPixels(startPoint.x + startRect.x, t2p);
|
|
||||||
*aY = NSTwipsToIntPixels(startPoint.y, t2p);
|
|
||||||
*aWidth = NSTwipsToIntPixels(endPoint.x + endRect.x, t2p) - *aX;
|
|
||||||
*aHeight = NSTwipsToIntPixels(endRect.y + endRect.height -
|
|
||||||
startPoint.y - startRect.y , t2p);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
|
@ -1,98 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* 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 Corp.
|
|
||||||
* Portions created by Netscape Corp.are Copyright (C) 2003 Netscape
|
|
||||||
* Corp. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Original Author: Aaron Leventhal
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the NPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef _nsTextAccessibleWrap_H_
|
|
||||||
#define _nsTextAccessibleWrap_H_
|
|
||||||
|
|
||||||
#include "nsTextAccessible.h"
|
|
||||||
#include "ISimpleDOMText.h"
|
|
||||||
#include "nsRect.h"
|
|
||||||
|
|
||||||
class nsIFrame;
|
|
||||||
class nsIPresContext;
|
|
||||||
class nsIRenderingContext;
|
|
||||||
|
|
||||||
class nsTextAccessibleWrap : public nsTextAccessible,
|
|
||||||
public ISimpleDOMText
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsTextAccessibleWrap(nsIDOMNode *, nsIWeakReference* aShell);
|
|
||||||
virtual ~nsTextAccessibleWrap() {}
|
|
||||||
|
|
||||||
// IUnknown methods - see iunknown.h for documentation
|
|
||||||
STDMETHODIMP_(ULONG) AddRef();
|
|
||||||
STDMETHODIMP_(ULONG) Release();
|
|
||||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
|
||||||
|
|
||||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_domText(
|
|
||||||
/* [retval][out] */ BSTR __RPC_FAR *domText);
|
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE get_clippedSubstringBounds(
|
|
||||||
/* [in] */ unsigned int startIndex,
|
|
||||||
/* [in] */ unsigned int endIndex,
|
|
||||||
/* [out] */ int __RPC_FAR *x,
|
|
||||||
/* [out] */ int __RPC_FAR *y,
|
|
||||||
/* [out] */ int __RPC_FAR *width,
|
|
||||||
/* [out] */ int __RPC_FAR *height);
|
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE get_unclippedSubstringBounds(
|
|
||||||
/* [in] */ unsigned int startIndex,
|
|
||||||
/* [in] */ unsigned int endIndex,
|
|
||||||
/* [out] */ int __RPC_FAR *x,
|
|
||||||
/* [out] */ int __RPC_FAR *y,
|
|
||||||
/* [out] */ int __RPC_FAR *width,
|
|
||||||
/* [out] */ int __RPC_FAR *height);
|
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE scrollToSubstring(
|
|
||||||
/* [in] */ unsigned int startIndex,
|
|
||||||
/* [in] */ unsigned int endIndex);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
nsresult GetCharacterExtents(PRInt32 aStartOffset, PRInt32 aEndOffset,
|
|
||||||
PRInt32* aX, PRInt32* aY,
|
|
||||||
PRInt32* aWidth, PRInt32* aHeight);
|
|
||||||
|
|
||||||
// Return child frame containing offset on success
|
|
||||||
nsIFrame* GetPointFromOffset(nsIFrame *aContainingFrame, nsIPresContext *aPresContext,
|
|
||||||
nsIRenderingContext *aRenderingContext,
|
|
||||||
PRInt32 aOffset, nsPoint& aOutPoint);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* 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 Corp.
|
|
||||||
* Portions created by Netscape Corp.are Copyright (C) 2003 Netscape
|
|
||||||
* Corp. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Original Author: Aaron Leventhal
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the NPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
#ifndef _nsTextAccessibleWrap_H_
|
|
||||||
#define _nsTextAccessibleWrap_H_
|
|
||||||
|
|
||||||
typedef class nsTextAccessible nsTextAccessibleWrap;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -46,7 +46,7 @@
|
||||||
* For XUL descriptions and labels
|
* For XUL descriptions and labels
|
||||||
*/
|
*/
|
||||||
nsXULTextAccessible::nsXULTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
nsXULTextAccessible::nsXULTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||||
nsTextAccessibleWrap(aDomNode, aShell)
|
nsTextAccessible(aDomNode, aShell)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,11 +41,11 @@
|
||||||
#ifndef _nsXULTextAccessible_H_
|
#ifndef _nsXULTextAccessible_H_
|
||||||
#define _nsXULTextAccessible_H_
|
#define _nsXULTextAccessible_H_
|
||||||
|
|
||||||
#include "nsTextAccessibleWrap.h"
|
#include "nsTextAccessible.h"
|
||||||
|
|
||||||
class nsIWeakReference;
|
class nsIWeakReference;
|
||||||
|
|
||||||
class nsXULTextAccessible : public nsTextAccessibleWrap
|
class nsXULTextAccessible : public nsTextAccessible
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче