From bc5e4a1f4f40ff2e2ef7ca7b53dea549dff7a0c1 Mon Sep 17 00:00:00 2001 From: "aaronl%netscape.com" Date: Sat, 17 May 2003 12:00:07 +0000 Subject: [PATCH] Backing out changes until I can figure out what's happening git-svn-id: svn://10.0.0.236/trunk@142585 18797224-902f-48f8-a5cc-f745e15eee43 --- .../public/msaa/AccessibleMarshal.c | 3 +- .../accessible/public/msaa/ISimpleDOMText.idl | 50 ---- mozilla/accessible/public/msaa/Makefile.in | 10 +- mozilla/accessible/src/atk/Makefile.in | 2 - .../accessible/src/atk/nsAccessibleText.cpp | 119 ++++---- mozilla/accessible/src/atk/nsAccessibleText.h | 1 - .../accessible/src/atk/nsTextAccessibleWrap.h | 46 --- .../accessible/src/base/nsDocAccessible.cpp | 57 +--- .../src/base/nsOuterDocAccessible.cpp | 5 - .../src/base/nsOuterDocAccessible.h | 2 - .../src/html/nsHTMLTextAccessible.cpp | 2 +- .../src/html/nsHTMLTextAccessible.h | 4 +- .../accessible/src/mac/nsTextAccessibleWrap.h | 45 --- mozilla/accessible/src/msaa/Makefile.in | 2 - .../src/msaa/nsDocAccessibleWrap.cpp | 10 +- .../src/msaa/nsTextAccessibleWrap.cpp | 262 ------------------ .../src/msaa/nsTextAccessibleWrap.h | 98 ------- .../src/other/nsTextAccessibleWrap.h | 45 --- .../src/xul/nsXULTextAccessible.cpp | 2 +- .../accessible/src/xul/nsXULTextAccessible.h | 4 +- 20 files changed, 82 insertions(+), 687 deletions(-) delete mode 100755 mozilla/accessible/public/msaa/ISimpleDOMText.idl delete mode 100644 mozilla/accessible/src/atk/nsTextAccessibleWrap.h delete mode 100755 mozilla/accessible/src/mac/nsTextAccessibleWrap.h delete mode 100755 mozilla/accessible/src/msaa/nsTextAccessibleWrap.cpp delete mode 100755 mozilla/accessible/src/msaa/nsTextAccessibleWrap.h delete mode 100755 mozilla/accessible/src/other/nsTextAccessibleWrap.h diff --git a/mozilla/accessible/public/msaa/AccessibleMarshal.c b/mozilla/accessible/public/msaa/AccessibleMarshal.c index e5a5286d14f..e0bfa4880a1 100755 --- a/mozilla/accessible/public/msaa/AccessibleMarshal.c +++ b/mozilla/accessible/public/msaa/AccessibleMarshal.c @@ -6,13 +6,12 @@ extern "C" { EXTERN_PROXY_FILE( ISimpleDOMDocument ) EXTERN_PROXY_FILE( ISimpleDOMNode ) -EXTERN_PROXY_FILE( ISimpleDOMText ) + PROXYFILE_LIST_START /* Start of list */ REFERENCE_PROXY_FILE( ISimpleDOMDocument ), REFERENCE_PROXY_FILE( ISimpleDOMNode ), - REFERENCE_PROXY_FILE( ISimpleDOMText ), /* End of list */ PROXYFILE_LIST_END diff --git a/mozilla/accessible/public/msaa/ISimpleDOMText.idl b/mozilla/accessible/public/msaa/ISimpleDOMText.idl deleted file mode 100755 index 723017847a9..00000000000 --- a/mozilla/accessible/public/msaa/ISimpleDOMText.idl +++ /dev/null @@ -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); -}; - diff --git a/mozilla/accessible/public/msaa/Makefile.in b/mozilla/accessible/public/msaa/Makefile.in index dee917f47ef..f655244a621 100755 --- a/mozilla/accessible/public/msaa/Makefile.in +++ b/mozilla/accessible/public/msaa/Makefile.in @@ -65,8 +65,6 @@ CSRCS = \ ISimpleDOMNode_i.c \ ISimpleDOMDocument_p.c \ ISimpleDOMDocument_i.c \ - ISimpleDOMText_p.c \ - ISimpleDOMText_i.c \ $(NULL) MIDL_GENERATED_FILES = \ @@ -76,9 +74,6 @@ MIDL_GENERATED_FILES = \ ISimpleDOMDocument.h \ ISimpleDOMDocument_p.c \ ISimpleDOMDocument_i.c \ - ISimpleDOMText.h \ - ISimpleDOMText_p.c \ - ISimpleDOMText_i.c \ $(NULL) SRCDIR_CSRCS = $(addprefix $(srcdir)/,$(CSRCS)) @@ -93,10 +88,9 @@ OS_LIBS = \ $(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)/ISimpleDOMDocument.idl - "$(MIDL)" $(srcdir)/ISimpleDOMText.idl touch $@ EXPORTS = \ @@ -104,8 +98,6 @@ EXPORTS = \ ISimpleDOMNode_i.c \ ISimpleDOMDocument.h \ ISimpleDOMDocument_i.c \ - ISimpleDOMText.h \ - ISimpleDOMText_i.c \ $(NULL) export:: done_gen diff --git a/mozilla/accessible/src/atk/Makefile.in b/mozilla/accessible/src/atk/Makefile.in index 7f68ab9ae3d..bf975618faa 100644 --- a/mozilla/accessible/src/atk/Makefile.in +++ b/mozilla/accessible/src/atk/Makefile.in @@ -100,8 +100,6 @@ EXPORTS = \ nsAccessibleWrap.h \ nsDocAccessibleWrap.h \ nsRootAccessibleWrap.h \ - nsTextAccessibleWrap.h \ - nsAccessibleText.h \ $(NULL) # we want to force the creation of a static lib. diff --git a/mozilla/accessible/src/atk/nsAccessibleText.cpp b/mozilla/accessible/src/atk/nsAccessibleText.cpp index 5bf9ae0d21f..307d4d3ff61 100644 --- a/mozilla/accessible/src/atk/nsAccessibleText.cpp +++ b/mozilla/accessible/src/atk/nsAccessibleText.cpp @@ -38,7 +38,7 @@ * ***** END LICENSE BLOCK ***** */ // NOTE: alphabetically ordered -#include "nsTextAccessibleWrap.h" +#include "nsAccessibleText.h" #include "nsContentCID.h" #include "nsIAccessibleEventReceiver.h" #include "nsIClipboard.h" @@ -67,31 +67,29 @@ 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) - -nsTextAccessibleWrap::nsTextAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell): -nsTextAccessible(aDOMNode, aShell) -{ -} +NS_IMPL_ISUPPORTS1(nsAccessibleText, nsIAccessibleText) /** - * nsTextAccessibleWrap implements the nsIAccessibleText interface for static text which mDOMNode + * nsAccessibleText implements the nsIAccessibleText interface for static text which mTextNode * has nsITextContent interface */ +nsAccessibleText::nsAccessibleText(nsIDOMNode *aNode) +{ + mTextNode = aNode; +} /** * nsIAccessibleText helpers */ -nsresult nsTextAccessibleWrap::GetSelections(nsISelectionController **aSelCon, nsISelection **aDomSel) +nsresult nsAccessibleText::GetSelections(nsISelectionController **aSelCon, nsISelection **aDomSel) { nsCOMPtr domDoc; - mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc)); + mTextNode->GetOwnerDocument(getter_AddRefs(domDoc)); nsCOMPtr doc(do_QueryInterface(domDoc)); NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); @@ -99,7 +97,7 @@ nsresult nsTextAccessibleWrap::GetSelections(nsISelectionController **aSelCon, n doc->GetShellAt(0, getter_AddRefs(shell)); NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); - nsCOMPtr content(do_QueryInterface(mDOMNode)); + nsCOMPtr content(do_QueryInterface(mTextNode)); nsIFrame *frame = nsnull; shell->GetPrimaryFrameFor(content, &frame); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); @@ -133,7 +131,7 @@ nsresult nsTextAccessibleWrap::GetSelections(nsISelectionController **aSelCon, n 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); @@ -229,7 +227,7 @@ nsresult nsTextAccessibleWrap::DOMPointToOffset(nsISupports *aClosure, nsIDOMNod 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); @@ -321,7 +319,7 @@ nsresult nsTextAccessibleWrap::OffsetToDOMPoint(nsISupports *aClosure, PRInt32 a return NS_ERROR_FAILURE; } -nsresult nsTextAccessibleWrap::GetCurrectOffset(nsISupports *aClosure, nsISelection *aDomSel, PRInt32 *aOffset) +nsresult nsAccessibleText::GetCurrectOffset(nsISupports *aClosure, nsISelection *aDomSel, PRInt32 *aOffset) { nsCOMPtr focusNode; aDomSel->GetFocusNode(getter_AddRefs(focusNode)); @@ -355,10 +353,10 @@ ATK_TEXT_BOUNDARY_LINE_START ATK_TEXT_BOUNDARY_LINE_END 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, - PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset, - nsISelectionController *aSelCon, nsISelection *aDomSel, - nsISupports *aClosure, nsAString &aText) +nsresult nsAccessibleText::GetTextHelperCore(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType, + PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset, + nsISelectionController *aSelCon, nsISelection *aDomSel, + nsISupports *aClosure, nsAString &aText) { PRInt32 rangeCount; nsCOMPtr range, oldRange; @@ -395,7 +393,7 @@ nsresult nsTextAccessibleWrap::GetTextHelperCore(EGetTextType aType, nsTextAcces 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 startFocusNode, endFocusNode; switch (aBoundaryType) { @@ -467,7 +465,7 @@ nsresult nsTextAccessibleWrap::GetTextHelperCore(EGetTextType aType, nsTextAcces return NS_OK; } -nsresult nsTextAccessibleWrap::GetTextHelper(EGetTextType aType, nsTextAccessibleWrapBoundary aBoundaryType, +nsresult nsAccessibleText::GetTextHelper(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType, PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsISupports *aClosure, nsAString &aText) { @@ -515,7 +513,7 @@ nsresult nsTextAccessibleWrap::GetTextHelper(EGetTextType aType, nsTextAccessibl /* * Gets the offset position of the caret (cursor). */ -NS_IMETHODIMP nsTextAccessibleWrap::GetCaretOffset(PRInt32 *aCaretOffset) +NS_IMETHODIMP nsAccessibleText::GetCaretOffset(PRInt32 *aCaretOffset) { nsCOMPtr domSel; nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel)); @@ -523,7 +521,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetCaretOffset(PRInt32 *aCaretOffset) nsCOMPtr focusNode; domSel->GetFocusNode(getter_AddRefs(focusNode)); - if (focusNode != mDOMNode) + if (focusNode != mTextNode) return NS_ERROR_FAILURE; return domSel->GetFocusOffset(aCaretOffset); @@ -532,7 +530,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetCaretOffset(PRInt32 *aCaretOffset) /* * Sets the caret (cursor) position to the specified offset. */ -NS_IMETHODIMP nsTextAccessibleWrap::SetCaretOffset(PRInt32 aCaretOffset) +NS_IMETHODIMP nsAccessibleText::SetCaretOffset(PRInt32 aCaretOffset) { nsCOMPtr domSel; nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel)); @@ -541,8 +539,8 @@ NS_IMETHODIMP nsTextAccessibleWrap::SetCaretOffset(PRInt32 aCaretOffset) nsCOMPtr range(do_CreateInstance(kRangeCID)); NS_ENSURE_TRUE(range, NS_ERROR_OUT_OF_MEMORY); - range->SetStart(mDOMNode, aCaretOffset); - range->SetEnd(mDOMNode, aCaretOffset); + range->SetStart(mTextNode, aCaretOffset); + range->SetEnd(mTextNode, aCaretOffset); domSel->RemoveAllRanges(); return domSel->AddRange(range); } @@ -550,9 +548,9 @@ NS_IMETHODIMP nsTextAccessibleWrap::SetCaretOffset(PRInt32 aCaretOffset) /* * Gets the character count. */ -NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterCount(PRInt32 *aCharacterCount) +NS_IMETHODIMP nsAccessibleText::GetCharacterCount(PRInt32 *aCharacterCount) { - nsCOMPtr textContent(do_QueryInterface(mDOMNode)); + nsCOMPtr textContent(do_QueryInterface(mTextNode)); if (!textContent) return NS_ERROR_FAILURE; @@ -562,7 +560,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterCount(PRInt32 *aCharacterCount) /* * Gets the number of selected regions. */ -NS_IMETHODIMP nsTextAccessibleWrap::GetSelectionCount(PRInt32 *aSelectionCount) +NS_IMETHODIMP nsAccessibleText::GetSelectionCount(PRInt32 *aSelectionCount) { nsCOMPtr domSel; nsresult rv = GetSelections(nsnull, getter_AddRefs(domSel)); @@ -584,27 +582,27 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetSelectionCount(PRInt32 *aSelectionCount) /* * 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; - mDOMNode->GetNodeValue(text); + mTextNode->GetNodeValue(text); aText = Substring(text, aStartOffset, aEndOffset - aStartOffset); 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) { 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) { 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) { return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, nsnull, aText); @@ -613,7 +611,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetTextAfterOffset(PRInt32 aOffset, nsTextAc /* * Gets the specified text. */ -NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar *aCharacter) +NS_IMETHODIMP nsAccessibleText::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar *aCharacter) { nsAutoString text; nsresult rv = GetText(aOffset, aOffset + 1, text); @@ -622,7 +620,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterAtOffset(PRInt32 aOffset, PRUnic return NS_OK; } -NS_IMETHODIMP nsTextAccessibleWrap::GetAttributeRange(PRInt32 aOffset, PRInt32 *aRangeStartOffset, +NS_IMETHODIMP nsAccessibleText::GetAttributeRange(PRInt32 aOffset, PRInt32 *aRangeStartOffset, PRInt32 *aRangeEndOffset, nsISupports **aAttribute) { // 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. */ -NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aOffset, +NS_IMETHODIMP nsAccessibleText::GetCharacterExtents(PRInt32 aOffset, PRInt32 *aX, PRInt32 *aY, PRInt32 *aWidth, PRInt32 *aHeight, nsAccessibleCoordType aCoordType) { nsCOMPtr domDoc; - mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc)); + mTextNode->GetOwnerDocument(getter_AddRefs(domDoc)); nsCOMPtr doc(do_QueryInterface(domDoc)); NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); @@ -652,7 +650,7 @@ NS_IMETHODIMP nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aOffset, shell->GetPresContext(getter_AddRefs(context)); NS_ENSURE_TRUE(context, NS_ERROR_FAILURE); - nsCOMPtr content(do_QueryInterface(mDOMNode)); + nsCOMPtr content(do_QueryInterface(mTextNode)); NS_ENSURE_TRUE(content, NS_ERROR_FAILURE); 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 * 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 *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. */ -NS_IMETHODIMP nsTextAccessibleWrap::GetSelectionBounds(PRInt32 aSelectionNum, PRInt32 *aStartOffset, PRInt32 *aEndOffset) +NS_IMETHODIMP nsAccessibleText::GetSelectionBounds(PRInt32 aSelectionNum, PRInt32 *aStartOffset, PRInt32 *aEndOffset) { nsCOMPtr 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. */ -NS_IMETHODIMP nsTextAccessibleWrap::SetSelectionBounds(PRInt32 aSelectionNum, PRInt32 aStartOffset, PRInt32 aEndOffset) +NS_IMETHODIMP nsAccessibleText::SetSelectionBounds(PRInt32 aSelectionNum, PRInt32 aStartOffset, PRInt32 aEndOffset) { nsCOMPtr 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. */ -NS_IMETHODIMP nsTextAccessibleWrap::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset) +NS_IMETHODIMP nsAccessibleText::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset) { nsCOMPtr selCon; nsCOMPtr domSel; @@ -857,15 +855,15 @@ NS_IMETHODIMP nsTextAccessibleWrap::AddSelection(PRInt32 aStartOffset, PRInt32 a if (! range) return NS_ERROR_OUT_OF_MEMORY; - range->SetStart(mDOMNode, aStartOffset); - range->SetEnd(mDOMNode, aEndOffset); + range->SetStart(mTextNode, aStartOffset); + range->SetEnd(mTextNode, aEndOffset); return domSel->AddRange(range); } /* * Removes the specified selection. */ -NS_IMETHODIMP nsTextAccessibleWrap::RemoveSelection(PRInt32 aSelectionNum) +NS_IMETHODIMP nsAccessibleText::RemoveSelection(PRInt32 aSelectionNum) { nsCOMPtr 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) nsAccessibleEditableText::nsAccessibleEditableText(nsIDOMNode *aNode): -nsTextAccessibleWrap(aNode) +nsAccessibleText(aNode) { } @@ -936,7 +934,7 @@ nsresult nsAccessibleEditableText::FireTextChangeEvent(AtkTextChange *aTextData) nsITextControlFrame* nsAccessibleEditableText::GetTextFrame() { nsCOMPtr domDoc; - mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc)); + mTextNode->GetOwnerDocument(getter_AddRefs(domDoc)); nsCOMPtr doc(do_QueryInterface(domDoc)); NS_ENSURE_TRUE(doc, nsnull); @@ -944,7 +942,7 @@ nsITextControlFrame* nsAccessibleEditableText::GetTextFrame() doc->GetShellAt(0, getter_AddRefs(shell)); NS_ENSURE_TRUE(shell, nsnull); - nsCOMPtr content(do_QueryInterface(mDOMNode)); + nsCOMPtr content(do_QueryInterface(mTextNode)); nsIFrame *frame = nsnull; shell->GetPrimaryFrameFor(content, &frame); NS_ENSURE_TRUE(frame, nsnull); @@ -1052,19 +1050,19 @@ NS_IMETHODIMP nsAccessibleEditableText::GetText(PRInt32 aStartOffset, PRInt32 aE 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) { 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) { 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) { 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) { - nsCOMPtr textArea(do_QueryInterface(mDOMNode)); + nsCOMPtr textArea(do_QueryInterface(mTextNode)); if (textArea) return textArea->SetValue(aText); - nsCOMPtr inputElement(do_QueryInterface(mDOMNode)); + nsCOMPtr inputElement(do_QueryInterface(mTextNode)); if (inputElement) return inputElement->SetValue(aText); @@ -1265,3 +1263,12 @@ NS_IMETHODIMP nsAccessibleEditableText::DidDeleteSelection(nsISelection *aSelect return NS_OK; } +// -------------------------------------------------------- +// nsTextAccessibleWrap Accessible +// -------------------------------------------------------- +NS_IMPL_ISUPPORTS_INHERITED1(nsTextAccessibleWrap, nsTextAccessible, nsAccessibleText) + +nsTextAccessibleWrap::nsTextAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell): +nsTextAccessible(aDOMNode, aShell), nsAccessibleText(aDOMNode) +{ +} diff --git a/mozilla/accessible/src/atk/nsAccessibleText.h b/mozilla/accessible/src/atk/nsAccessibleText.h index 3785308eaaf..701fd22bb20 100644 --- a/mozilla/accessible/src/atk/nsAccessibleText.h +++ b/mozilla/accessible/src/atk/nsAccessibleText.h @@ -48,7 +48,6 @@ #include "nsIEditor.h" #include "nsISelectionController.h" #include "nsITextControlFrame.h" -#include "nsTextAccessibleWrap.h" #include "nsTextAccessible.h" enum EGetTextType { eGetBefore=-1, eGetAt=0, eGetAfter=1 }; diff --git a/mozilla/accessible/src/atk/nsTextAccessibleWrap.h b/mozilla/accessible/src/atk/nsTextAccessibleWrap.h deleted file mode 100644 index 44583d551a9..00000000000 --- a/mozilla/accessible/src/atk/nsTextAccessibleWrap.h +++ /dev/null @@ -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 diff --git a/mozilla/accessible/src/base/nsDocAccessible.cpp b/mozilla/accessible/src/base/nsDocAccessible.cpp index 111a7540d64..93513e5a4b2 100644 --- a/mozilla/accessible/src/base/nsDocAccessible.cpp +++ b/mozilla/accessible/src/base/nsDocAccessible.cpp @@ -98,16 +98,15 @@ nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell) nsCOMPtr vm; shell->GetViewManager(getter_AddRefs(vm)); nsCOMPtr widget; - if (vm) { - vm->GetWidget(getter_AddRefs(widget)); - if (widget) { - mWnd = widget->GetNativeData(NS_NATIVE_WINDOW); - } - } + vm->GetWidget(getter_AddRefs(widget)); + mWnd = widget->GetNativeData(NS_NATIVE_WINDOW); } NS_ASSERTION(gGlobalDocAccessibleCache, "No global doc accessible cache"); 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? #ifdef OLD_HASH @@ -409,52 +408,10 @@ nsIFrame* nsDocAccessible::GetFrame() void nsDocAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame) { *aRelativeFrame = GetFrame(); - - nsCOMPtr document(mDocument); - nsRect viewBounds; - nsCOMPtr vm; - nsCOMPtr parentDoc; - - while (document) { - nsCOMPtr 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; - } + if (*aRelativeFrame) + (*aRelativeFrame)->GetRect(aBounds); } - void nsDocAccessible::AddContentDocListeners() { // 1) Set up scroll position listener diff --git a/mozilla/accessible/src/base/nsOuterDocAccessible.cpp b/mozilla/accessible/src/base/nsOuterDocAccessible.cpp index 9cd6f9b86ac..34b061b4f34 100644 --- a/mozilla/accessible/src/base/nsOuterDocAccessible.cpp +++ b/mozilla/accessible/src/base/nsOuterDocAccessible.cpp @@ -82,8 +82,3 @@ NS_IMETHODIMP nsOuterDocAccessible::GetAccState(PRUint32 *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; -} diff --git a/mozilla/accessible/src/base/nsOuterDocAccessible.h b/mozilla/accessible/src/base/nsOuterDocAccessible.h index 9d5133c590f..7bfb3be35b5 100644 --- a/mozilla/accessible/src/base/nsOuterDocAccessible.h +++ b/mozilla/accessible/src/base/nsOuterDocAccessible.h @@ -57,8 +57,6 @@ class nsOuterDocAccessible : public nsBlockAccessible NS_IMETHOD GetAccValue(nsAString& AccValue); NS_IMETHOD GetAccRole(PRUint32 *aAccRole); NS_IMETHOD GetAccState(PRUint32 *aAccState); - NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, - PRInt32 *width, PRInt32 *height); }; #endif diff --git a/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp b/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp index 7764a265d0b..90bc4df2f3c 100644 --- a/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp +++ b/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp @@ -46,7 +46,7 @@ #include "nsISelectionController.h" nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell): -nsTextAccessibleWrap(aDomNode, aShell) +nsTextAccessible(aDomNode, aShell) { } diff --git a/mozilla/accessible/src/html/nsHTMLTextAccessible.h b/mozilla/accessible/src/html/nsHTMLTextAccessible.h index 66d2570e19e..0e81f2db3a4 100644 --- a/mozilla/accessible/src/html/nsHTMLTextAccessible.h +++ b/mozilla/accessible/src/html/nsHTMLTextAccessible.h @@ -40,11 +40,11 @@ #ifndef _nsHTMLTextAccessible_H_ #define _nsHTMLTextAccessible_H_ -#include "nsTextAccessibleWrap.h" +#include "nsTextAccessible.h" class nsIWeakReference; -class nsHTMLTextAccessible : public nsTextAccessibleWrap +class nsHTMLTextAccessible : public nsTextAccessible { public: diff --git a/mozilla/accessible/src/mac/nsTextAccessibleWrap.h b/mozilla/accessible/src/mac/nsTextAccessibleWrap.h deleted file mode 100755 index 49f5fa9cf01..00000000000 --- a/mozilla/accessible/src/mac/nsTextAccessibleWrap.h +++ /dev/null @@ -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 diff --git a/mozilla/accessible/src/msaa/Makefile.in b/mozilla/accessible/src/msaa/Makefile.in index da913253a2b..e8359253209 100644 --- a/mozilla/accessible/src/msaa/Makefile.in +++ b/mozilla/accessible/src/msaa/Makefile.in @@ -67,7 +67,6 @@ REQUIRES = content \ CPPSRCS = \ nsAccessNodeWrap.cpp \ nsAccessibleWrap.cpp \ - nsTextAccessibleWrap.cpp \ nsDocAccessibleWrap.cpp \ nsRootAccessibleWrap.cpp \ nsHTMLWin32ObjectAccessible.cpp \ @@ -76,7 +75,6 @@ CPPSRCS = \ EXPORTS = \ nsAccessNodeWrap.h \ nsAccessibleWrap.h \ - nsTextAccessibleWrap.h \ nsDocAccessibleWrap.h \ nsRootAccessibleWrap.h \ nsHTMLWin32ObjectAccessible.h \ diff --git a/mozilla/accessible/src/msaa/nsDocAccessibleWrap.cpp b/mozilla/accessible/src/msaa/nsDocAccessibleWrap.cpp index 0cb4b3cb0ba..8702749baf8 100644 --- a/mozilla/accessible/src/msaa/nsDocAccessibleWrap.cpp +++ b/mozilla/accessible/src/msaa/nsDocAccessibleWrap.cpp @@ -138,12 +138,10 @@ STDMETHODIMP nsDocAccessibleWrap::get_accChild( getter_AddRefs(parentDocAccessible)); nsCOMPtr accessible(do_QueryInterface(parentDocAccessible)); IAccessible *msaaParentDoc; - if (accessible) { - accessible->GetNativeInterface((void**)&msaaParentDoc); - HRESULT rv = msaaParentDoc->get_accChild(varChild, ppdispChild); - msaaParentDoc->Release(); - return rv; - } + accessible->GetNativeInterface((void**)&msaaParentDoc); + HRESULT rv = msaaParentDoc->get_accChild(varChild, ppdispChild); + msaaParentDoc->Release(); + return rv; } } } diff --git a/mozilla/accessible/src/msaa/nsTextAccessibleWrap.cpp b/mozilla/accessible/src/msaa/nsTextAccessibleWrap.cpp deleted file mode 100755 index 1b42a73a550..00000000000 --- a/mozilla/accessible/src/msaa/nsTextAccessibleWrap.cpp +++ /dev/null @@ -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 docAccessible(GetDocAccessible()); - nsCOMPtr 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 presShell(GetPresShell()); - nsIFrame *frame = GetFrame(); - - if (!frame || !presShell) { - return E_FAIL; // This accessible has been shut down - } - - nsCOMPtr presContext; - presShell->GetPresContext(getter_AddRefs(presContext)); - nsCOMPtr scrollToRange = do_CreateInstance(kRangeCID); - nsCOMPtr selCon; - frame->GetSelectionController(presContext, getter_AddRefs(selCon)); - if (!presContext || !scrollToRange || !selCon) { - return E_FAIL; - } - - scrollToRange->SetStart(mDOMNode, aStartIndex); - scrollToRange->SetEnd(mDOMNode, aEndIndex); - nsCOMPtr 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 presShell(GetPresShell()); - NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); - - nsCOMPtr 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 content(do_QueryInterface(mDOMNode)); - presShell->GetPrimaryFrameFor(content, &frame); - NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); - - nsCOMPtr viewManager; - presShell->GetViewManager(getter_AddRefs(viewManager)); - NS_ASSERTION(viewManager, "No view manager for pres shell"); - - nsCOMPtr 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; -} diff --git a/mozilla/accessible/src/msaa/nsTextAccessibleWrap.h b/mozilla/accessible/src/msaa/nsTextAccessibleWrap.h deleted file mode 100755 index 1b7698395f6..00000000000 --- a/mozilla/accessible/src/msaa/nsTextAccessibleWrap.h +++ /dev/null @@ -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 - diff --git a/mozilla/accessible/src/other/nsTextAccessibleWrap.h b/mozilla/accessible/src/other/nsTextAccessibleWrap.h deleted file mode 100755 index 49f5fa9cf01..00000000000 --- a/mozilla/accessible/src/other/nsTextAccessibleWrap.h +++ /dev/null @@ -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 diff --git a/mozilla/accessible/src/xul/nsXULTextAccessible.cpp b/mozilla/accessible/src/xul/nsXULTextAccessible.cpp index f45b5ebd54d..6ac18c22e71 100644 --- a/mozilla/accessible/src/xul/nsXULTextAccessible.cpp +++ b/mozilla/accessible/src/xul/nsXULTextAccessible.cpp @@ -46,7 +46,7 @@ * For XUL descriptions and labels */ nsXULTextAccessible::nsXULTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell): -nsTextAccessibleWrap(aDomNode, aShell) +nsTextAccessible(aDomNode, aShell) { } diff --git a/mozilla/accessible/src/xul/nsXULTextAccessible.h b/mozilla/accessible/src/xul/nsXULTextAccessible.h index aa239dd6f2c..38212cd69ad 100644 --- a/mozilla/accessible/src/xul/nsXULTextAccessible.h +++ b/mozilla/accessible/src/xul/nsXULTextAccessible.h @@ -41,11 +41,11 @@ #ifndef _nsXULTextAccessible_H_ #define _nsXULTextAccessible_H_ -#include "nsTextAccessibleWrap.h" +#include "nsTextAccessible.h" class nsIWeakReference; -class nsXULTextAccessible : public nsTextAccessibleWrap +class nsXULTextAccessible : public nsTextAccessible { public: