mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix for bug 378197 - use nsIAccessibleCoordinateType in nsIAccessibleText, r=evan.yan
This commit is contained in:
parent
2491d0c723
commit
d597d38157
@ -42,11 +42,10 @@
|
||||
#include "nsISupports.idl"
|
||||
|
||||
typedef long nsAccessibleTextBoundary;
|
||||
typedef long nsAccessibleCoordType;
|
||||
|
||||
interface nsIAccessible;
|
||||
|
||||
[scriptable, uuid(80e64909-e96b-45e9-81c9-3521a2dea7bb)]
|
||||
[scriptable, uuid(17389a66-5cc5-4550-80e0-49e7b63990a4)]
|
||||
interface nsIAccessibleText : nsISupports
|
||||
{
|
||||
const nsAccessibleTextBoundary BOUNDARY_CHAR = 0;
|
||||
@ -58,9 +57,6 @@ interface nsIAccessibleText : nsISupports
|
||||
const nsAccessibleTextBoundary BOUNDARY_LINE_END = 6;
|
||||
const nsAccessibleTextBoundary BOUNDARY_ATTRIBUTE_RANGE = 7;
|
||||
|
||||
const nsAccessibleCoordType COORD_TYPE_SCREEN = 0;
|
||||
const nsAccessibleCoordType COORD_TYPE_WINDOW = 1;
|
||||
|
||||
attribute long caretOffset;
|
||||
|
||||
readonly attribute long characterCount;
|
||||
@ -104,12 +100,36 @@ interface nsIAccessibleText : nsISupports
|
||||
out long rangeStartOffset,
|
||||
out long rangeEndOffset);
|
||||
|
||||
/**
|
||||
* Returns the bounding box of the specified position.
|
||||
*
|
||||
* The virtual character after the last character of the represented text,
|
||||
* i.e. the one at position length is a special case. It represents the
|
||||
* current input position and will therefore typically be queried by AT more
|
||||
* often than other positions. Because it does not represent an existing
|
||||
* character its bounding box is defined in relation to preceding characters.
|
||||
* It should be roughly equivalent to the bounding box of some character when
|
||||
* inserted at the end of the text. Its height typically being the maximal
|
||||
* height of all the characters in the text or the height of the preceding
|
||||
* character, its width being at least one pixel so that the bounding box is
|
||||
* not degenerate.
|
||||
*
|
||||
* @param offset - Index of the character for which to return its bounding
|
||||
* box. The valid range is 0..length.
|
||||
* @param x - X coordinate of the bounding box of the referenced character.
|
||||
* @param y - Y coordinate of the bounding box of the referenced character.
|
||||
* @param width - Width of the bounding box of the referenced character.
|
||||
* @param height - Height of the bounding box of the referenced character.
|
||||
* @param coordType - Specifies if the coordinates are relative to the screen
|
||||
* or to the parent window (see constants declared in
|
||||
* nsIAccessibleCoordinateType).
|
||||
*/
|
||||
void getCharacterExtents (in long offset,
|
||||
out long x,
|
||||
out long y,
|
||||
out long width,
|
||||
out long height,
|
||||
in nsAccessibleCoordType coordType);
|
||||
in unsigned long coordType);
|
||||
|
||||
void getRangeExtents (in long startOffset,
|
||||
in long endOffset,
|
||||
@ -117,14 +137,24 @@ interface nsIAccessibleText : nsISupports
|
||||
out long y,
|
||||
out long width,
|
||||
out long height,
|
||||
in nsAccessibleCoordType coordType);
|
||||
in unsigned long coordType);
|
||||
|
||||
/**
|
||||
* Get the text offset at the given point, or return -1
|
||||
* if no character exists at that point
|
||||
*
|
||||
* @param x - The position's x value for which to look up the index of the
|
||||
* character that is rendered on to the display at that point.
|
||||
* @param y - The position's y value for which to look up the index of the
|
||||
* character that is rendered on to the display at that point.
|
||||
* @param coordType - Screen coordinates or window coordinates (see constants
|
||||
* declared in nsIAccessibleCoordinateType).
|
||||
* @return offset - Index of the character under the given point or -1 if
|
||||
* the point is invalid or there is no character under
|
||||
* the point.
|
||||
*/
|
||||
long getOffsetAtPoint (in long x, in long y,
|
||||
in nsAccessibleCoordType coordType);
|
||||
in unsigned long coordType);
|
||||
|
||||
void getSelectionBounds (in long selectionNum,
|
||||
out long startOffset,
|
||||
|
@ -87,7 +87,7 @@ interface nsIAccessibleScrollType : nsISupports
|
||||
* These constants define which coordinate system a point is located in. Note,
|
||||
* keep them synchronized with IA2CoordinateType.
|
||||
*/
|
||||
[scriptable, uuid(15a523bb-fb3b-4cb2-af87-ad26ea792c4c)]
|
||||
[scriptable, uuid(c9fbdf10-619e-436f-bf4b-8566686f1577)]
|
||||
interface nsIAccessibleCoordinateType : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -95,9 +95,14 @@ interface nsIAccessibleCoordinateType : nsISupports
|
||||
*/
|
||||
const unsigned long COORDTYPE_SCREEN_RELATIVE = 0x00;
|
||||
|
||||
/**
|
||||
* The coordinates are relative to the window.
|
||||
*/
|
||||
const unsigned long COORDTYPE_WINDOW_RELATIVE = 0x01;
|
||||
|
||||
/**
|
||||
* The coordinates are relative to the upper left corner of the bounding box
|
||||
* of the immediate parent.
|
||||
*/
|
||||
const unsigned long COORDTYPE_PARENT_RELATIVE = 0x01;
|
||||
const unsigned long COORDTYPE_PARENT_RELATIVE = 0x02;
|
||||
};
|
||||
|
@ -284,9 +284,14 @@ getCharacterExtentsCB(AtkText *aText, gint aOffset,
|
||||
|
||||
PRInt32 extY = 0, extX = 0;
|
||||
PRInt32 extWidth = 0, extHeight = 0;
|
||||
|
||||
PRUint32 geckoCoordType = (aCoords == ATK_XY_SCREEN) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE;
|
||||
|
||||
nsresult rv = accText->GetCharacterExtents(aOffset, &extX, &extY,
|
||||
&extWidth, &extHeight,
|
||||
aCoords);
|
||||
geckoCoordType);
|
||||
*aX = extX;
|
||||
*aY = extY;
|
||||
*aWidth = extWidth;
|
||||
@ -311,10 +316,15 @@ getRangeExtentsCB(AtkText *aText, gint aStartOffset, gint aEndOffset,
|
||||
|
||||
PRInt32 extY = 0, extX = 0;
|
||||
PRInt32 extWidth = 0, extHeight = 0;
|
||||
|
||||
PRUint32 geckoCoordType = (aCoords == ATK_XY_SCREEN) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE;
|
||||
|
||||
nsresult rv = accText->GetRangeExtents(aStartOffset, aEndOffset,
|
||||
&extX, &extY,
|
||||
&extWidth, &extHeight,
|
||||
aCoords);
|
||||
geckoCoordType);
|
||||
aRect->x = extX;
|
||||
aRect->y = extY;
|
||||
aRect->width = extWidth;
|
||||
@ -353,7 +363,11 @@ getOffsetAtPointCB(AtkText *aText,
|
||||
NS_ENSURE_TRUE(accText, -1);
|
||||
|
||||
PRInt32 offset = 0;
|
||||
accText->GetOffsetAtPoint(aX, aY, aCoords, &offset);
|
||||
PRUint32 geckoCoordType = (aCoords == ATK_XY_SCREEN) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE;
|
||||
|
||||
accText->GetOffsetAtPoint(aX, aY, geckoCoordType, &offset);
|
||||
return NS_STATIC_CAST(gint, offset);
|
||||
}
|
||||
|
||||
|
@ -855,7 +855,7 @@ nsHyperTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
|
||||
*/
|
||||
NS_IMETHODIMP nsHyperTextAccessible::GetCharacterExtents(PRInt32 aOffset, PRInt32 *aX, PRInt32 *aY,
|
||||
PRInt32 *aWidth, PRInt32 *aHeight,
|
||||
nsAccessibleCoordType aCoordType)
|
||||
PRUint32 aCoordType)
|
||||
{
|
||||
return GetRangeExtents(aOffset, aOffset + 1, aX, aY, aWidth, aHeight, aCoordType);
|
||||
}
|
||||
@ -866,7 +866,7 @@ NS_IMETHODIMP nsHyperTextAccessible::GetCharacterExtents(PRInt32 aOffset, PRInt3
|
||||
NS_IMETHODIMP nsHyperTextAccessible::GetRangeExtents(PRInt32 aStartOffset, PRInt32 aEndOffset,
|
||||
PRInt32 *aX, PRInt32 *aY,
|
||||
PRInt32 *aWidth, PRInt32 *aHeight,
|
||||
nsAccessibleCoordType aCoordType)
|
||||
PRUint32 aCoordType)
|
||||
{
|
||||
nsIntRect boundsRect;
|
||||
nsIFrame *endFrameUnused;
|
||||
@ -879,7 +879,7 @@ NS_IMETHODIMP nsHyperTextAccessible::GetRangeExtents(PRInt32 aStartOffset, PRInt
|
||||
*aWidth = boundsRect.width;
|
||||
*aHeight = boundsRect.height;
|
||||
|
||||
if (aCoordType == COORD_TYPE_WINDOW) {
|
||||
if (aCoordType == nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE) {
|
||||
//co-ord type = window
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
|
||||
@ -911,7 +911,9 @@ NS_IMETHODIMP nsHyperTextAccessible::GetRangeExtents(PRInt32 aStartOffset, PRInt
|
||||
* 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 nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY, nsAccessibleCoordType aCoordType, PRInt32 *aOffset)
|
||||
NS_IMETHODIMP
|
||||
nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
PRUint32 aCoordType, PRInt32 *aOffset)
|
||||
{
|
||||
*aOffset = -1;
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
@ -924,7 +926,7 @@ NS_IMETHODIMP nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY, ns
|
||||
}
|
||||
nsIntRect frameScreenRect = hyperFrame->GetScreenRectExternal();
|
||||
|
||||
if (aCoordType == COORD_TYPE_WINDOW) {
|
||||
if (aCoordType == nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE) {
|
||||
nsCOMPtr<nsIDocument> doc = shell->GetDocument();
|
||||
nsCOMPtr<nsIDOMDocumentView> docView(do_QueryInterface(doc));
|
||||
NS_ENSURE_TRUE(docView, NS_ERROR_FAILURE);
|
||||
|
Loading…
Reference in New Issue
Block a user