Bug 1748878: Use LayoutDeviceInt types for points, rects, sizes in dev pixels r=Jamie,emilio

Differential Revision: https://phabricator.services.mozilla.com/D135272
This commit is contained in:
Morgan Reschenberg 2022-01-18 23:31:21 +00:00
Родитель 09258d00f1
Коммит ac66a0e8a8
48 изменённых файлов: 222 добавлений и 204 удалений

Просмотреть файл

@ -660,11 +660,11 @@ mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle(bool aSmall) {
} }
mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle( mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle(
const uint64_t aState, const nsIntRect& aBounds, const uint8_t aActionCount, const uint64_t aState, const LayoutDeviceIntRect& aBounds,
const nsString& aName, const nsString& aTextValue, const uint8_t aActionCount, const nsString& aName,
const nsString& aDOMNodeID, const nsString& aDescription, const nsString& aTextValue, const nsString& aDOMNodeID,
const double& aCurVal, const double& aMinVal, const double& aMaxVal, const nsString& aDescription, const double& aCurVal, const double& aMinVal,
const double& aStep, AccAttributes* aAttributes) { const double& aMaxVal, const double& aStep, AccAttributes* aAttributes) {
if (!IsProxy() && IsDefunct()) { if (!IsProxy() && IsDefunct()) {
return nullptr; return nullptr;
} }

Просмотреть файл

@ -55,7 +55,7 @@ class AccessibleWrap : public LocalAccessible {
mozilla::java::GeckoBundle::LocalRef ToBundle(bool aSmall = false); mozilla::java::GeckoBundle::LocalRef ToBundle(bool aSmall = false);
mozilla::java::GeckoBundle::LocalRef ToBundle( mozilla::java::GeckoBundle::LocalRef ToBundle(
const uint64_t aState, const nsIntRect& aBounds, const uint64_t aState, const LayoutDeviceIntRect& aBounds,
const uint8_t aActionCount, const nsString& aName, const uint8_t aActionCount, const nsString& aName,
const nsString& aTextValue, const nsString& aDOMNodeID, const nsString& aTextValue, const nsString& aDOMNodeID,
const nsString& aDescription, const nsString& aDescription,

Просмотреть файл

@ -74,7 +74,9 @@ void RemoteAccessibleWrap::Value(nsString& aValue) const {
uint64_t RemoteAccessibleWrap::State() { return Proxy()->State(); } uint64_t RemoteAccessibleWrap::State() { return Proxy()->State(); }
nsIntRect RemoteAccessibleWrap::Bounds() const { return Proxy()->Bounds(); } mozilla::LayoutDeviceIntRect RemoteAccessibleWrap::Bounds() const {
return Proxy()->Bounds();
}
void RemoteAccessibleWrap::ScrollTo(uint32_t aHow) const { void RemoteAccessibleWrap::ScrollTo(uint32_t aHow) const {
Proxy()->ScrollTo(aHow); Proxy()->ScrollTo(aHow);

Просмотреть файл

@ -41,7 +41,7 @@ class RemoteAccessibleWrap : public AccessibleWrap {
virtual uint64_t State() override; virtual uint64_t State() override;
virtual nsIntRect Bounds() const override; virtual LayoutDeviceIntRect Bounds() const override;
MOZ_CAN_RUN_SCRIPT MOZ_CAN_RUN_SCRIPT
virtual void ScrollTo(uint32_t aHow) const override; virtual void ScrollTo(uint32_t aHow) const override;

Просмотреть файл

@ -105,7 +105,8 @@ AtkObject* refAccessibleAtPointHelper(AtkObject* aAtkObj, gint aX, gint aY,
node = browser->GetOwnerElement(); node = browser->GetOwnerElement();
} }
MOZ_ASSERT(node); MOZ_ASSERT(node);
nsIntPoint winCoords = nsCoreUtils::GetScreenCoordsForWindow(node); mozilla::LayoutDeviceIntPoint winCoords =
nsCoreUtils::GetScreenCoordsForWindow(node);
aX += winCoords.x; aX += winCoords.x;
aY += winCoords.y; aY += winCoords.y;
} }
@ -138,11 +139,11 @@ void getExtentsHelper(AtkObject* aAtkObj, gint* aX, gint* aY, gint* aWidth,
return; return;
} }
nsIntRect screenRect = accWrap->Bounds(); mozilla::LayoutDeviceIntRect screenRect = accWrap->Bounds();
if (screenRect.IsEmpty()) return; if (screenRect.IsEmpty()) return;
if (aCoordType == ATK_XY_WINDOW) { if (aCoordType == ATK_XY_WINDOW) {
nsIntPoint winCoords = mozilla::LayoutDeviceIntPoint winCoords =
nsCoreUtils::GetScreenCoordsForWindow(accWrap->GetNode()); nsCoreUtils::GetScreenCoordsForWindow(accWrap->GetNode());
screenRect.x -= winCoords.x; screenRect.x -= winCoords.x;
screenRect.y -= winCoords.y; screenRect.y -= winCoords.y;

Просмотреть файл

@ -21,7 +21,7 @@ const gchar* getDescriptionCB(AtkObject* aAtkObj);
static void getImagePositionCB(AtkImage* aImage, gint* aAccX, gint* aAccY, static void getImagePositionCB(AtkImage* aImage, gint* aAccX, gint* aAccY,
AtkCoordType aCoordType) { AtkCoordType aCoordType) {
nsIntPoint pos = nsIntPoint(-1, -1); LayoutDeviceIntPoint pos(-1, -1);
uint32_t geckoCoordType = uint32_t geckoCoordType =
(aCoordType == ATK_XY_WINDOW) (aCoordType == ATK_XY_WINDOW)
? nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE ? nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE
@ -45,7 +45,7 @@ static const gchar* getImageDescriptionCB(AtkImage* aImage) {
static void getImageSizeCB(AtkImage* aImage, gint* aAccWidth, static void getImageSizeCB(AtkImage* aImage, gint* aAccWidth,
gint* aAccHeight) { gint* aAccHeight) {
nsIntSize size = nsIntSize(-1, -1); LayoutDeviceIntSize size(-1, -1);
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImage)); AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImage));
if (accWrap && accWrap->IsImage()) { if (accWrap && accWrap->IsImage()) {
size = accWrap->AsImage()->Size(); size = accWrap->AsImage()->Size();

Просмотреть файл

@ -317,7 +317,7 @@ static void getCharacterExtentsCB(AtkText* aText, gint aOffset, gint* aX,
} }
*aX = *aY = *aWidth = *aHeight = -1; *aX = *aY = *aWidth = *aHeight = -1;
nsIntRect rect; LayoutDeviceIntRect rect;
uint32_t geckoCoordType; uint32_t geckoCoordType;
if (aCoords == ATK_XY_SCREEN) { if (aCoords == ATK_XY_SCREEN) {
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE; geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;
@ -353,7 +353,7 @@ static void getRangeExtentsCB(AtkText* aText, gint aStartOffset,
} }
aRect->x = aRect->y = aRect->width = aRect->height = -1; aRect->x = aRect->y = aRect->width = aRect->height = -1;
nsIntRect rect; LayoutDeviceIntRect rect;
uint32_t geckoCoordType; uint32_t geckoCoordType;
if (aCoords == ATK_XY_SCREEN) { if (aCoords == ATK_XY_SCREEN) {
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE; geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;

Просмотреть файл

@ -547,8 +547,9 @@ Accessible* Pivot::AtPoint(int32_t aX, int32_t aY, PivotRule& aRule) {
// Match if no node below this is a match // Match if no node below this is a match
if ((filtered & nsIAccessibleTraversalRule::FILTER_MATCH) && !match) { if ((filtered & nsIAccessibleTraversalRule::FILTER_MATCH) && !match) {
nsIntRect childRect = child->IsLocal() ? child->AsLocal()->Bounds() LayoutDeviceIntRect childRect = child->IsLocal()
: child->AsRemote()->Bounds(); ? child->AsLocal()->Bounds()
: child->AsRemote()->Bounds();
// Double-check child's bounds since the deepest child may have been out // Double-check child's bounds since the deepest child may have been out
// of bounds. This assures we don't return a false positive. // of bounds. This assures we don't return a false positive.
if (childRect.Contains(aX, aY)) { if (childRect.Contains(aX, aY)) {

Просмотреть файл

@ -244,10 +244,10 @@ HyperTextAccessible* nsAccUtils::GetTextContainer(nsINode* aNode) {
return nullptr; return nullptr;
} }
nsIntPoint nsAccUtils::ConvertToScreenCoords(int32_t aX, int32_t aY, LayoutDeviceIntPoint nsAccUtils::ConvertToScreenCoords(
uint32_t aCoordinateType, int32_t aX, int32_t aY, uint32_t aCoordinateType,
LocalAccessible* aAccessible) { LocalAccessible* aAccessible) {
nsIntPoint coords(aX, aY); LayoutDeviceIntPoint coords(aX, aY);
switch (aCoordinateType) { switch (aCoordinateType) {
case nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE: case nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE:
@ -278,7 +278,7 @@ void nsAccUtils::ConvertScreenCoordsTo(int32_t* aX, int32_t* aY,
break; break;
case nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE: { case nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE: {
nsIntPoint coords = LayoutDeviceIntPoint coords =
nsCoreUtils::GetScreenCoordsForWindow(aAccessible->GetNode()); nsCoreUtils::GetScreenCoordsForWindow(aAccessible->GetNode());
*aX -= coords.x; *aX -= coords.x;
*aY -= coords.y; *aY -= coords.y;
@ -286,7 +286,7 @@ void nsAccUtils::ConvertScreenCoordsTo(int32_t* aX, int32_t* aY,
} }
case nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE: { case nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE: {
nsIntPoint coords = GetScreenCoordsForParent(aAccessible); LayoutDeviceIntPoint coords = GetScreenCoordsForParent(aAccessible);
*aX -= coords.x; *aX -= coords.x;
*aY -= coords.y; *aY -= coords.y;
break; break;
@ -297,16 +297,18 @@ void nsAccUtils::ConvertScreenCoordsTo(int32_t* aX, int32_t* aY,
} }
} }
nsIntPoint nsAccUtils::GetScreenCoordsForParent(LocalAccessible* aAccessible) { LayoutDeviceIntPoint nsAccUtils::GetScreenCoordsForParent(
LocalAccessible* aAccessible) {
LocalAccessible* parent = aAccessible->LocalParent(); LocalAccessible* parent = aAccessible->LocalParent();
if (!parent) return nsIntPoint(0, 0); if (!parent) return LayoutDeviceIntPoint(0, 0);
nsIFrame* parentFrame = parent->GetFrame(); nsIFrame* parentFrame = parent->GetFrame();
if (!parentFrame) return nsIntPoint(0, 0); if (!parentFrame) return LayoutDeviceIntPoint(0, 0);
nsRect rect = parentFrame->GetScreenRectInAppUnits(); nsRect rect = parentFrame->GetScreenRectInAppUnits();
return nsPoint(rect.X(), rect.Y()) nscoord appUnitsRatio = parentFrame->PresContext()->AppUnitsPerDevPixel();
.ToNearestPixels(parentFrame->PresContext()->AppUnitsPerDevPixel()); return LayoutDeviceIntPoint::FromAppUnitsToNearest(
nsPoint(rect.X(), rect.Y()), appUnitsRatio);
} }
bool nsAccUtils::GetLiveAttrValue(uint32_t aRule, nsAString& aValue) { bool nsAccUtils::GetLiveAttrValue(uint32_t aRule, nsAString& aValue) {

Просмотреть файл

@ -131,24 +131,24 @@ class nsAccUtils {
/** /**
* Converts the given coordinates to coordinates relative screen. * Converts the given coordinates to coordinates relative screen.
* *
* @param aX [in] the given x coord * @param aX [in] the given x coord in dev pixels
* @param aY [in] the given y coord * @param aY [in] the given y coord in dev pixels
* @param aCoordinateType [in] specifies coordinates origin (refer to * @param aCoordinateType [in] specifies coordinates origin (refer to
* nsIAccessibleCoordinateType) * nsIAccessibleCoordinateType)
* @param aAccessible [in] the accessible if coordinates are given * @param aAccessible [in] the accessible if coordinates are given
* relative it. * relative it.
* @return converted coordinates * @return converted coordinates
*/ */
static nsIntPoint ConvertToScreenCoords(int32_t aX, int32_t aY, static LayoutDeviceIntPoint ConvertToScreenCoords(
uint32_t aCoordinateType, int32_t aX, int32_t aY, uint32_t aCoordinateType,
LocalAccessible* aAccessible); LocalAccessible* aAccessible);
/** /**
* Converts the given coordinates relative screen to another coordinate * Converts the given coordinates relative screen to another coordinate
* system. * system.
* *
* @param aX [in, out] the given x coord * @param aX [in, out] the given x coord in dev pixels
* @param aY [in, out] the given y coord * @param aY [in, out] the given y coord in dev pixels
* @param aCoordinateType [in] specifies coordinates origin (refer to * @param aCoordinateType [in] specifies coordinates origin (refer to
* nsIAccessibleCoordinateType) * nsIAccessibleCoordinateType)
* @param aAccessible [in] the accessible if coordinates are given * @param aAccessible [in] the accessible if coordinates are given
@ -159,11 +159,13 @@ class nsAccUtils {
LocalAccessible* aAccessible); LocalAccessible* aAccessible);
/** /**
* Returns coordinates relative screen for the parent of the given accessible. * Returns screen-relative coordinates (in dev pixels) for the parent of the
* given accessible.
* *
* @param [in] aAccessible the accessible * @param [in] aAccessible the accessible
*/ */
static nsIntPoint GetScreenCoordsForParent(LocalAccessible* aAccessible); static LayoutDeviceIntPoint GetScreenCoordsForParent(
LocalAccessible* aAccessible);
/** /**
* Get the 'live' or 'container-live' object attribute value from the given * Get the 'live' or 'container-live' object attribute value from the given

Просмотреть файл

@ -255,12 +255,12 @@ nsresult nsCoreUtils::ScrollSubstringTo(nsIFrame* aFrame, nsRange* aRange,
void nsCoreUtils::ScrollFrameToPoint(nsIFrame* aScrollableFrame, void nsCoreUtils::ScrollFrameToPoint(nsIFrame* aScrollableFrame,
nsIFrame* aFrame, nsIFrame* aFrame,
const nsIntPoint& aPoint) { const LayoutDeviceIntPoint& aPoint) {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aScrollableFrame); nsIScrollableFrame* scrollableFrame = do_QueryFrame(aScrollableFrame);
if (!scrollableFrame) return; if (!scrollableFrame) return;
nsPoint point = nsPoint point = LayoutDeviceIntPoint::ToAppUnits(
ToAppUnits(aPoint, aFrame->PresContext()->AppUnitsPerDevPixel()); aPoint, aFrame->PresContext()->AppUnitsPerDevPixel());
nsRect frameRect = aFrame->GetScreenRectInAppUnits(); nsRect frameRect = aFrame->GetScreenRectInAppUnits();
nsPoint deltaPoint = point - frameRect.TopLeft(); nsPoint deltaPoint = point - frameRect.TopLeft();
@ -322,8 +322,8 @@ void nsCoreUtils::ConvertScrollTypeToPercents(uint32_t aScrollType,
*aHorizontal = ScrollAxis(whereX, whenX); *aHorizontal = ScrollAxis(whereX, whenX);
} }
nsIntPoint nsCoreUtils::GetScreenCoordsForWindow(nsINode* aNode) { LayoutDeviceIntPoint nsCoreUtils::GetScreenCoordsForWindow(nsINode* aNode) {
nsIntPoint coords(0, 0); LayoutDeviceIntPoint coords(0, 0);
nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShellFor(aNode)); nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShellFor(aNode));
if (!treeItem) return coords; if (!treeItem) return coords;

Просмотреть файл

@ -14,6 +14,7 @@
#include "nsPoint.h" #include "nsPoint.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "Units.h"
class nsRange; class nsRange;
class nsTreeColumn; class nsTreeColumn;
@ -167,10 +168,10 @@ class nsCoreUtils {
* *
* @param aScrollableFrame the scrollable frame * @param aScrollableFrame the scrollable frame
* @param aFrame the frame to scroll * @param aFrame the frame to scroll
* @param aPoint the point scroll to * @param aPoint the point scroll to (in dev pixels)
*/ */
static void ScrollFrameToPoint(nsIFrame* aScrollableFrame, nsIFrame* aFrame, static void ScrollFrameToPoint(nsIFrame* aScrollableFrame, nsIFrame* aFrame,
const nsIntPoint& aPoint); const mozilla::LayoutDeviceIntPoint& aPoint);
/** /**
* Converts scroll type constant defined in nsIAccessibleScrollType to * Converts scroll type constant defined in nsIAccessibleScrollType to
@ -186,7 +187,7 @@ class nsCoreUtils {
* *
* @param aNode the DOM node hosted in the window. * @param aNode the DOM node hosted in the window.
*/ */
static nsIntPoint GetScreenCoordsForWindow(nsINode* aNode); static mozilla::LayoutDeviceIntPoint GetScreenCoordsForWindow(nsINode* aNode);
/** /**
* Return document shell for the given DOM node. * Return document shell for the given DOM node.

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/a11y/AccTypes.h" #include "mozilla/a11y/AccTypes.h"
#include "nsString.h" #include "nsString.h"
#include "nsRect.h" #include "nsRect.h"
#include "Units.h"
class nsAtom; class nsAtom;
@ -157,7 +158,10 @@ class Accessible {
virtual double MaxValue() const = 0; virtual double MaxValue() const = 0;
virtual double Step() const = 0; virtual double Step() const = 0;
virtual nsIntRect Bounds() const = 0; /**
* Return boundaries in screen coordinates in device pixels.
*/
virtual LayoutDeviceIntRect Bounds() const = 0;
/** /**
* Returns text of accessible if accessible has text role otherwise empty * Returns text of accessible if accessible has text role otherwise empty

Просмотреть файл

@ -94,7 +94,9 @@ Relation ApplicationAccessible::RelationByType(
return Relation(); return Relation();
} }
nsIntRect ApplicationAccessible::Bounds() const { return nsIntRect(); } mozilla::LayoutDeviceIntRect ApplicationAccessible::Bounds() const {
return mozilla::LayoutDeviceIntRect();
}
nsRect ApplicationAccessible::BoundsInAppUnits() const { return nsRect(); } nsRect ApplicationAccessible::BoundsInAppUnits() const { return nsRect(); }

Просмотреть файл

@ -33,7 +33,7 @@ class ApplicationAccessible : public AccessibleWrap {
// LocalAccessible // LocalAccessible
virtual void Shutdown() override; virtual void Shutdown() override;
virtual nsIntRect Bounds() const override; virtual LayoutDeviceIntRect Bounds() const override;
virtual nsRect BoundsInAppUnits() const override; virtual nsRect BoundsInAppUnits() const override;
virtual already_AddRefed<AccAttributes> NativeAttributes() override; virtual already_AddRefed<AccAttributes> NativeAttributes() override;
virtual GroupPos GroupPosition() override; virtual GroupPos GroupPosition() override;

Просмотреть файл

@ -206,22 +206,22 @@ uint64_t HyperTextAccessible::NativeState() const {
return states; return states;
} }
nsIntRect HyperTextAccessible::GetBoundsInFrame(nsIFrame* aFrame, LayoutDeviceIntRect HyperTextAccessible::GetBoundsInFrame(
uint32_t aStartRenderedOffset, nsIFrame* aFrame, uint32_t aStartRenderedOffset,
uint32_t aEndRenderedOffset) { uint32_t aEndRenderedOffset) {
nsPresContext* presContext = mDoc->PresContext(); nsPresContext* presContext = mDoc->PresContext();
if (!aFrame->IsTextFrame()) { if (!aFrame->IsTextFrame()) {
return aFrame->GetScreenRectInAppUnits().ToNearestPixels( return LayoutDeviceIntRect::FromAppUnitsToNearest(
presContext->AppUnitsPerDevPixel()); aFrame->GetScreenRectInAppUnits(), presContext->AppUnitsPerDevPixel());
} }
// Substring must be entirely within the same text node. // Substring must be entirely within the same text node.
int32_t startContentOffset, endContentOffset; int32_t startContentOffset, endContentOffset;
nsresult rv = RenderedToContentOffset(aFrame, aStartRenderedOffset, nsresult rv = RenderedToContentOffset(aFrame, aStartRenderedOffset,
&startContentOffset); &startContentOffset);
NS_ENSURE_SUCCESS(rv, nsIntRect()); NS_ENSURE_SUCCESS(rv, LayoutDeviceIntRect());
rv = RenderedToContentOffset(aFrame, aEndRenderedOffset, &endContentOffset); rv = RenderedToContentOffset(aFrame, aEndRenderedOffset, &endContentOffset);
NS_ENSURE_SUCCESS(rv, nsIntRect()); NS_ENSURE_SUCCESS(rv, LayoutDeviceIntRect());
nsIFrame* frame; nsIFrame* frame;
int32_t startContentOffsetInFrame; int32_t startContentOffsetInFrame;
@ -229,7 +229,7 @@ nsIntRect HyperTextAccessible::GetBoundsInFrame(nsIFrame* aFrame,
// the primary frame passed in // the primary frame passed in
rv = aFrame->GetChildFrameContainingOffset( rv = aFrame->GetChildFrameContainingOffset(
startContentOffset, false, &startContentOffsetInFrame, &frame); startContentOffset, false, &startContentOffsetInFrame, &frame);
NS_ENSURE_SUCCESS(rv, nsIntRect()); NS_ENSURE_SUCCESS(rv, LayoutDeviceIntRect());
nsRect screenRect; nsRect screenRect;
while (frame && startContentOffset < endContentOffset) { while (frame && startContentOffset < endContentOffset) {
@ -248,13 +248,13 @@ nsIntRect HyperTextAccessible::GetBoundsInFrame(nsIFrame* aFrame,
// Add the point where the string starts to the frameScreenRect // Add the point where the string starts to the frameScreenRect
nsPoint frameTextStartPoint; nsPoint frameTextStartPoint;
rv = frame->GetPointFromOffset(startContentOffset, &frameTextStartPoint); rv = frame->GetPointFromOffset(startContentOffset, &frameTextStartPoint);
NS_ENSURE_SUCCESS(rv, nsIntRect()); NS_ENSURE_SUCCESS(rv, LayoutDeviceIntRect());
// Use the point for the end offset to calculate the width // Use the point for the end offset to calculate the width
nsPoint frameTextEndPoint; nsPoint frameTextEndPoint;
rv = frame->GetPointFromOffset(startContentOffset + frameSubStringLength, rv = frame->GetPointFromOffset(startContentOffset + frameSubStringLength,
&frameTextEndPoint); &frameTextEndPoint);
NS_ENSURE_SUCCESS(rv, nsIntRect()); NS_ENSURE_SUCCESS(rv, LayoutDeviceIntRect());
frameScreenRect.SetRectX( frameScreenRect.SetRectX(
frameScreenRect.X() + frameScreenRect.X() +
@ -269,7 +269,8 @@ nsIntRect HyperTextAccessible::GetBoundsInFrame(nsIFrame* aFrame,
frame = frame->GetNextContinuation(); frame = frame->GetNextContinuation();
} }
return screenRect.ToNearestPixels(presContext->AppUnitsPerDevPixel()); return LayoutDeviceIntRect::FromAppUnitsToNearest(
screenRect, presContext->AppUnitsPerDevPixel());
} }
uint32_t HyperTextAccessible::DOMPointToOffset(nsINode* aNode, uint32_t HyperTextAccessible::DOMPointToOffset(nsINode* aNode,
@ -1424,12 +1425,12 @@ int32_t HyperTextAccessible::OffsetAtPoint(int32_t aX, int32_t aY,
nsIFrame* hyperFrame = GetFrame(); nsIFrame* hyperFrame = GetFrame();
if (!hyperFrame) return -1; if (!hyperFrame) return -1;
nsIntPoint coords = LayoutDeviceIntPoint coords =
nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordType, this); nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordType, this);
nsPresContext* presContext = mDoc->PresContext(); nsPresContext* presContext = mDoc->PresContext();
nsPoint coordsInAppUnits = nsPoint coordsInAppUnits = LayoutDeviceIntPoint::ToAppUnits(
ToAppUnits(coords, presContext->AppUnitsPerDevPixel()); coords, presContext->AppUnitsPerDevPixel());
nsRect frameScreenRect = hyperFrame->GetScreenRectInAppUnits(); nsRect frameScreenRect = hyperFrame->GetScreenRectInAppUnits();
if (!frameScreenRect.Contains(coordsInAppUnits.x, coordsInAppUnits.y)) { if (!frameScreenRect.Contains(coordsInAppUnits.x, coordsInAppUnits.y)) {
@ -1485,15 +1486,15 @@ int32_t HyperTextAccessible::OffsetAtPoint(int32_t aX, int32_t aY,
return -1; // Not found return -1; // Not found
} }
nsIntRect HyperTextAccessible::TextBounds(int32_t aStartOffset, LayoutDeviceIntRect HyperTextAccessible::TextBounds(int32_t aStartOffset,
int32_t aEndOffset, int32_t aEndOffset,
uint32_t aCoordType) { uint32_t aCoordType) {
index_t startOffset = ConvertMagicOffset(aStartOffset); index_t startOffset = ConvertMagicOffset(aStartOffset);
index_t endOffset = ConvertMagicOffset(aEndOffset); index_t endOffset = ConvertMagicOffset(aEndOffset);
if (!startOffset.IsValid() || !endOffset.IsValid() || if (!startOffset.IsValid() || !endOffset.IsValid() ||
startOffset > endOffset || endOffset > CharacterCount()) { startOffset > endOffset || endOffset > CharacterCount()) {
NS_ERROR("Wrong in offset"); NS_ERROR("Wrong in offset");
return nsIntRect(); return LayoutDeviceIntRect();
} }
if (CharacterCount() == 0) { if (CharacterCount() == 0) {
@ -1501,16 +1502,16 @@ nsIntRect HyperTextAccessible::TextBounds(int32_t aStartOffset,
// Empty content, use our own bound to at least get x,y coordinates // Empty content, use our own bound to at least get x,y coordinates
nsIFrame* frame = GetFrame(); nsIFrame* frame = GetFrame();
if (!frame) { if (!frame) {
return nsIntRect(); return LayoutDeviceIntRect();
} }
return frame->GetScreenRectInAppUnits().ToNearestPixels( return LayoutDeviceIntRect::FromAppUnitsToNearest(
presContext->AppUnitsPerDevPixel()); frame->GetScreenRectInAppUnits(), presContext->AppUnitsPerDevPixel());
} }
int32_t childIdx = GetChildIndexAtOffset(startOffset); int32_t childIdx = GetChildIndexAtOffset(startOffset);
if (childIdx == -1) return nsIntRect(); if (childIdx == -1) return LayoutDeviceIntRect();
nsIntRect bounds; LayoutDeviceIntRect bounds;
int32_t prevOffset = GetChildOffset(childIdx); int32_t prevOffset = GetChildOffset(childIdx);
int32_t offset1 = startOffset - prevOffset; int32_t offset1 = startOffset - prevOffset;
@ -1540,8 +1541,9 @@ nsIntRect HyperTextAccessible::TextBounds(int32_t aStartOffset,
// screen coordinates. // screen coordinates.
nsPresContext* presContext = mDoc->PresContext(); nsPresContext* presContext = mDoc->PresContext();
nsIFrame* rootFrame = presContext->PresShell()->GetRootFrame(); nsIFrame* rootFrame = presContext->PresShell()->GetRootFrame();
nsIntRect orgRectPixels = LayoutDeviceIntRect orgRectPixels =
rootFrame->GetScreenRectInAppUnits().ToNearestPixels( LayoutDeviceIntRect::FromAppUnitsToNearest(
rootFrame->GetScreenRectInAppUnits(),
presContext->AppUnitsPerDevPixel()); presContext->AppUnitsPerDevPixel());
bounds.MoveBy(-orgRectPixels.X(), -orgRectPixels.Y()); bounds.MoveBy(-orgRectPixels.X(), -orgRectPixels.Y());
bounds.ScaleRoundOut(presContext->PresShell()->GetResolution()); bounds.ScaleRoundOut(presContext->PresShell()->GetResolution());
@ -1803,7 +1805,7 @@ LayoutDeviceIntRect HyperTextAccessible::GetCaretRect(nsIWidget** aWidget) {
// focus. // focus.
return LayoutDeviceIntRect(); return LayoutDeviceIntRect();
} }
nsIntRect charRect = CharBounds( LayoutDeviceIntRect charRect = CharBounds(
caretOffset, nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE); caretOffset, nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE);
if (!charRect.IsEmpty()) { if (!charRect.IsEmpty()) {
caretRect.SetTopEdge(charRect.Y()); caretRect.SetTopEdge(charRect.Y());
@ -1945,7 +1947,7 @@ void HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset,
nsIFrame* frame = GetFrame(); nsIFrame* frame = GetFrame();
if (!frame) return; if (!frame) return;
nsIntPoint coords = LayoutDeviceIntPoint coords =
nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType, this); nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType, this);
RefPtr<nsRange> domRange = nsRange::Create(mContent); RefPtr<nsRange> domRange = nsRange::Create(mContent);
@ -1955,8 +1957,8 @@ void HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset,
} }
nsPresContext* presContext = frame->PresContext(); nsPresContext* presContext = frame->PresContext();
nsPoint coordsInAppUnits = nsPoint coordsInAppUnits = LayoutDeviceIntPoint::ToAppUnits(
ToAppUnits(coords, presContext->AppUnitsPerDevPixel()); coords, presContext->AppUnitsPerDevPixel());
bool initialScrolled = false; bool initialScrolled = false;
nsIFrame* parentFrame = frame; nsIFrame* parentFrame = frame;

Просмотреть файл

@ -184,18 +184,19 @@ class HyperTextAccessible : public AccessibleWrap,
int32_t OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType); int32_t OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType);
/** /**
* Return a rect of the given text range relative given coordinate system. * Return a rect (in dev pixels) of the given text range relative given
* coordinate system.
*/ */
nsIntRect TextBounds( LayoutDeviceIntRect TextBounds(
int32_t aStartOffset, int32_t aEndOffset, int32_t aStartOffset, int32_t aEndOffset,
uint32_t aCoordType = uint32_t aCoordType =
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE); nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE);
/** /**
* Return a rect for character at given offset relative given coordinate * Return a rect (in dev pixels) for character at given offset relative given
* system. * coordinate system.
*/ */
nsIntRect CharBounds(int32_t aOffset, uint32_t aCoordType) { LayoutDeviceIntRect CharBounds(int32_t aOffset, uint32_t aCoordType) {
int32_t endOffset = aOffset == static_cast<int32_t>(CharacterCount()) int32_t endOffset = aOffset == static_cast<int32_t>(CharacterCount())
? aOffset ? aOffset
: aOffset + 1; : aOffset + 1;
@ -394,11 +395,13 @@ class HyperTextAccessible : public AccessibleWrap,
EWordMovementType aWordMovementType = eDefaultBehavior); EWordMovementType aWordMovementType = eDefaultBehavior);
/** /**
* Return the boundaries of the substring in case of textual frame or * Return the boundaries (in dev pixels) of the substring in case of textual
* frame boundaries in case of non textual frame, offsets are ignored. * frame or frame boundaries in case of non textual frame, offsets are
* ignored.
*/ */
nsIntRect GetBoundsInFrame(nsIFrame* aFrame, uint32_t aStartRenderedOffset, LayoutDeviceIntRect GetBoundsInFrame(nsIFrame* aFrame,
uint32_t aEndRenderedOffset); uint32_t aStartRenderedOffset,
uint32_t aEndRenderedOffset);
// Selection helpers // Selection helpers

Просмотреть файл

@ -23,7 +23,7 @@
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsIURI.h" #include "nsIURI.h"
using namespace mozilla::a11y; namespace mozilla::a11y {
NS_IMPL_ISUPPORTS_INHERITED(ImageAccessible, LinkableAccessible, NS_IMPL_ISUPPORTS_INHERITED(ImageAccessible, LinkableAccessible,
imgINotificationObserver) imgINotificationObserver)
@ -137,7 +137,7 @@ bool ImageAccessible::DoAction(uint8_t aIndex) const {
nsCOMPtr<nsPIDOMWindowOuter> piWindow = document->GetWindow(); nsCOMPtr<nsPIDOMWindowOuter> piWindow = document->GetWindow();
if (!piWindow) return false; if (!piWindow) return false;
RefPtr<mozilla::dom::BrowsingContext> tmp; RefPtr<dom::BrowsingContext> tmp;
return NS_SUCCEEDED(piWindow->Open(spec, u""_ns, u""_ns, return NS_SUCCEEDED(piWindow->Open(spec, u""_ns, u""_ns,
/* aLoadInfo = */ nullptr, /* aLoadInfo = */ nullptr,
/* aForceNoOpener = */ false, /* aForceNoOpener = */ false,
@ -147,13 +147,13 @@ bool ImageAccessible::DoAction(uint8_t aIndex) const {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// ImageAccessible // ImageAccessible
nsIntPoint ImageAccessible::Position(uint32_t aCoordType) { LayoutDeviceIntPoint ImageAccessible::Position(uint32_t aCoordType) {
nsIntPoint point = Bounds().TopLeft(); LayoutDeviceIntPoint point = Bounds().TopLeft();
nsAccUtils::ConvertScreenCoordsTo(&point.x, &point.y, aCoordType, this); nsAccUtils::ConvertScreenCoordsTo(&point.x, &point.y, aCoordType, this);
return point; return point;
} }
nsIntSize ImageAccessible::Size() { return Bounds().Size(); } LayoutDeviceIntSize ImageAccessible::Size() { return Bounds().Size(); }
// LocalAccessible // LocalAccessible
already_AddRefed<AccAttributes> ImageAccessible::NativeAttributes() { already_AddRefed<AccAttributes> ImageAccessible::NativeAttributes() {
@ -247,3 +247,5 @@ void ImageAccessible::Notify(imgIRequest* aRequest, int32_t aType,
mImageRequestStatus = status; mImageRequestStatus = status;
} }
} // namespace mozilla::a11y

Просмотреть файл

@ -37,8 +37,8 @@ class ImageAccessible : public LinkableAccessible,
virtual bool DoAction(uint8_t aIndex) const override; virtual bool DoAction(uint8_t aIndex) const override;
// ImageAccessible // ImageAccessible
nsIntPoint Position(uint32_t aCoordType); LayoutDeviceIntPoint Position(uint32_t aCoordType);
nsIntSize Size(); LayoutDeviceIntSize Size();
protected: protected:
virtual ~ImageAccessible(); virtual ~ImageAccessible();

Просмотреть файл

@ -501,7 +501,7 @@ LocalAccessible* LocalAccessible::LocalChildAtPoint(
// If we can't find the point in a child, we will return the fallback answer: // If we can't find the point in a child, we will return the fallback answer:
// we return |this| if the point is within it, otherwise nullptr. // we return |this| if the point is within it, otherwise nullptr.
LocalAccessible* fallbackAnswer = nullptr; LocalAccessible* fallbackAnswer = nullptr;
nsIntRect rect = Bounds(); LayoutDeviceIntRect rect = Bounds();
if (rect.Contains(aX, aY)) fallbackAnswer = this; if (rect.Contains(aX, aY)) fallbackAnswer = this;
if (nsAccUtils::MustPrune(this)) { // Do not dig any further if (nsAccUtils::MustPrune(this)) { // Do not dig any further
@ -611,7 +611,7 @@ LocalAccessible* LocalAccessible::LocalChildAtPoint(
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) { for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
LocalAccessible* child = accessible->LocalChildAt(childIdx); LocalAccessible* child = accessible->LocalChildAt(childIdx);
nsIntRect childRect = child->Bounds(); LayoutDeviceIntRect childRect = child->Bounds();
if (childRect.Contains(aX, aY) && if (childRect.Contains(aX, aY) &&
(child->State() & states::INVISIBLE) == 0) { (child->State() & states::INVISIBLE) == 0) {
if (aWhichChild == EWhichChildAtPoint::DeepestChild) { if (aWhichChild == EWhichChildAtPoint::DeepestChild) {
@ -786,9 +786,9 @@ nsRect LocalAccessible::BoundsInAppUnits() const {
return unionRectTwips; return unionRectTwips;
} }
nsIntRect LocalAccessible::Bounds() const { LayoutDeviceIntRect LocalAccessible::Bounds() const {
return BoundsInAppUnits().ToNearestPixels( return LayoutDeviceIntRect::FromAppUnitsToNearest(
mDoc->PresContext()->AppUnitsPerDevPixel()); BoundsInAppUnits(), mDoc->PresContext()->AppUnitsPerDevPixel());
} }
nsIntRect LocalAccessible::BoundsInCSSPixels() const { nsIntRect LocalAccessible::BoundsInCSSPixels() const {
@ -2296,7 +2296,7 @@ void LocalAccessible::ScrollToPoint(uint32_t aCoordinateType, int32_t aX,
nsIFrame* frame = GetFrame(); nsIFrame* frame = GetFrame();
if (!frame) return; if (!frame) return;
nsIntPoint coords = LayoutDeviceIntPoint coords =
nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType, this); nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType, this);
nsIFrame* parentFrame = frame; nsIFrame* parentFrame = frame;

Просмотреть файл

@ -406,10 +406,7 @@ class LocalAccessible : public nsISupports, public Accessible {
*/ */
virtual nsRect BoundsInAppUnits() const; virtual nsRect BoundsInAppUnits() const;
/** virtual LayoutDeviceIntRect Bounds() const override;
* Return boundaries in screen coordinates.
*/
virtual nsIntRect Bounds() const override;
/** /**
* Return boundaries in screen coordinates in CSS pixels. * Return boundaries in screen coordinates in CSS pixels.

Просмотреть файл

@ -77,7 +77,7 @@ role OuterDocAccessible::NativeRole() const { return roles::INTERNAL_FRAME; }
LocalAccessible* OuterDocAccessible::LocalChildAtPoint( LocalAccessible* OuterDocAccessible::LocalChildAtPoint(
int32_t aX, int32_t aY, EWhichChildAtPoint aWhichChild) { int32_t aX, int32_t aY, EWhichChildAtPoint aWhichChild) {
nsIntRect docRect = Bounds(); LayoutDeviceIntRect docRect = Bounds();
if (!docRect.Contains(aX, aY)) return nullptr; if (!docRect.Contains(aX, aY)) return nullptr;
// Always return the inner doc as direct child accessible unless bounds // Always return the inner doc as direct child accessible unless bounds
@ -212,7 +212,7 @@ Accessible* OuterDocAccessible::ChildAt(uint32_t aIndex) const {
Accessible* OuterDocAccessible::ChildAtPoint(int32_t aX, int32_t aY, Accessible* OuterDocAccessible::ChildAtPoint(int32_t aX, int32_t aY,
EWhichChildAtPoint aWhichChild) { EWhichChildAtPoint aWhichChild) {
nsIntRect docRect = Bounds(); LayoutDeviceIntRect docRect = Bounds();
if (!docRect.Contains(aX, aY)) return nullptr; if (!docRect.Contains(aX, aY)) return nullptr;
// Always return the inner doc as direct child accessible unless bounds // Always return the inner doc as direct child accessible unless bounds

Просмотреть файл

@ -194,8 +194,8 @@ uint64_t HTMLSelectOptionAccessible::NativeState() const {
// <select> is not collapsed: compare bounds to calculate OFFSCREEN // <select> is not collapsed: compare bounds to calculate OFFSCREEN
LocalAccessible* listAcc = LocalParent(); LocalAccessible* listAcc = LocalParent();
if (listAcc) { if (listAcc) {
nsIntRect optionRect = Bounds(); LayoutDeviceIntRect optionRect = Bounds();
nsIntRect listRect = listAcc->Bounds(); LayoutDeviceIntRect listRect = listAcc->Bounds();
if (optionRect.Y() < listRect.Y() || if (optionRect.Y() < listRect.Y() ||
optionRect.YMost() > listRect.YMost()) { optionRect.YMost() > listRect.YMost()) {
state |= states::OFFSCREEN; state |= states::OFFSCREEN;

Просмотреть файл

@ -916,10 +916,10 @@ void DocAccessibleParent::MaybeInitWindowEmulation() {
MOZ_ASSERT(rootDocument); MOZ_ASSERT(rootDocument);
bool isActive = true; bool isActive = true;
nsIntRect rect(CW_USEDEFAULT, CW_USEDEFAULT, 0, 0); LayoutDeviceIntRect rect(CW_USEDEFAULT, CW_USEDEFAULT, 0, 0);
if (Compatibility::IsDolphin()) { if (Compatibility::IsDolphin()) {
rect = Bounds(); rect = Bounds();
nsIntRect rootRect = rootDocument->Bounds(); LayoutDeviceIntRect rootRect = rootDocument->Bounds();
rect.MoveToX(rootRect.X() - rect.X()); rect.MoveToX(rootRect.X() - rect.X());
rect.MoveToY(rect.Y() - rootRect.Y()); rect.MoveToY(rect.Y() - rootRect.Y());

Просмотреть файл

@ -270,12 +270,12 @@ Maybe<nsRect> RemoteAccessibleBase<Derived>::RetrieveCachedBounds() const {
} }
template <class Derived> template <class Derived>
nsIntRect RemoteAccessibleBase<Derived>::Bounds() const { LayoutDeviceIntRect RemoteAccessibleBase<Derived>::Bounds() const {
if (mCachedFields) { if (mCachedFields) {
Maybe<nsRect> maybeBounds = RetrieveCachedBounds(); Maybe<nsRect> maybeBounds = RetrieveCachedBounds();
if (maybeBounds) { if (maybeBounds) {
nsRect bounds = *maybeBounds; nsRect bounds = *maybeBounds;
nsIntRect devPxBounds; LayoutDeviceIntRect devPxBounds;
dom::CanonicalBrowsingContext* cbc = dom::CanonicalBrowsingContext* cbc =
static_cast<dom::BrowserParent*>(mDoc->Manager()) static_cast<dom::BrowserParent*>(mDoc->Manager())
->GetBrowsingContext() ->GetBrowsingContext()
@ -290,11 +290,11 @@ nsIntRect RemoteAccessibleBase<Derived>::Bounds() const {
const_cast<Accessible*>(acc)->AsLocal()) { const_cast<Accessible*>(acc)->AsLocal()) {
// LocalAccessible::Bounds returns screen-relative bounds in // LocalAccessible::Bounds returns screen-relative bounds in
// dev pixels. // dev pixels.
nsIntRect localBounds = localAcc->Bounds(); LayoutDeviceIntRect localBounds = localAcc->Bounds();
// Convert our existing `bounds` rect from app units to dev pixels // Convert our existing `bounds` rect from app units to dev pixels
devPxBounds = devPxBounds = LayoutDeviceIntRect::FromAppUnitsToNearest(
bounds.ToNearestPixels(presContext->AppUnitsPerDevPixel()); bounds, presContext->AppUnitsPerDevPixel());
// We factor in our zoom level before offsetting by // We factor in our zoom level before offsetting by
// `localBounds`, which has already taken zoom into account. // `localBounds`, which has already taken zoom into account.
@ -351,14 +351,14 @@ nsIntRect RemoteAccessibleBase<Derived>::Bounds() const {
// viewport. We calculate the difference and translate our bounds here. // viewport. We calculate the difference and translate our bounds here.
nsPoint viewportOffset = presShell->GetVisualViewportOffset() - nsPoint viewportOffset = presShell->GetVisualViewportOffset() -
presShell->GetLayoutViewportOffset(); presShell->GetLayoutViewportOffset();
devPxBounds.MoveBy(-( devPxBounds.MoveBy(-(LayoutDeviceIntPoint::FromAppUnitsToNearest(
viewportOffset.ToNearestPixels(presContext->AppUnitsPerDevPixel()))); viewportOffset, presContext->AppUnitsPerDevPixel())));
return devPxBounds; return devPxBounds;
} }
} }
return nsIntRect(); return LayoutDeviceIntRect();
} }
template <class Derived> template <class Derived>

Просмотреть файл

@ -176,7 +176,7 @@ class RemoteAccessibleBase : public Accessible, public HyperTextAccessibleBase {
virtual double MaxValue() const override; virtual double MaxValue() const override;
virtual double Step() const override; virtual double Step() const override;
virtual nsIntRect Bounds() const override; virtual LayoutDeviceIntRect Bounds() const override;
virtual uint64_t State() override; virtual uint64_t State() override;

Просмотреть файл

@ -94,12 +94,12 @@ void GetTextBeforeOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
char16_t CharAt(int32_t aOffset); char16_t CharAt(int32_t aOffset);
nsIntRect TextBounds( LayoutDeviceIntRect TextBounds(
int32_t aStartOffset, int32_t aEndOffset, int32_t aStartOffset, int32_t aEndOffset,
uint32_t aCoordType = uint32_t aCoordType =
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE); nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE);
nsIntRect CharBounds(int32_t aOffset, uint32_t aCoordType); LayoutDeviceIntRect CharBounds(int32_t aOffset, uint32_t aCoordType);
int32_t OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType); int32_t OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType);
@ -133,9 +133,9 @@ bool DeleteText(int32_t aStartPos, int32_t aEndPos);
bool PasteText(int32_t aPosition); bool PasteText(int32_t aPosition);
nsIntPoint ImagePosition(uint32_t aCoordType); LayoutDeviceIntPoint ImagePosition(uint32_t aCoordType);
nsIntSize ImageSize(); LayoutDeviceIntSize ImageSize();
uint32_t EndOffset(bool* aOk); uint32_t EndOffset(bool* aOk);
@ -234,7 +234,7 @@ RemoteAccessible* FocusedChild();
virtual Accessible* ChildAtPoint( virtual Accessible* ChildAtPoint(
int32_t aX, int32_t aY, int32_t aX, int32_t aY,
LocalAccessible::EWhichChildAtPoint aWhichChild) override; LocalAccessible::EWhichChildAtPoint aWhichChild) override;
nsIntRect Bounds() const override; LayoutDeviceIntRect Bounds() const override;
nsIntRect BoundsInCSSPixels(); nsIntRect BoundsInCSSPixels();
void Language(nsString& aLocale); void Language(nsString& aLocale);

Просмотреть файл

@ -109,12 +109,12 @@ mozilla::ipc::IPCResult DocAccessiblePlatformExtChild::RecvTextForRange(
mozilla::ipc::IPCResult DocAccessiblePlatformExtChild::RecvBoundsForRange( mozilla::ipc::IPCResult DocAccessiblePlatformExtChild::RecvBoundsForRange(
const uint64_t& aID, const int32_t& aStartOffset, const uint64_t& aID, const int32_t& aStartOffset,
const uint64_t& aEndContainer, const int32_t& aEndOffset, const uint64_t& aEndContainer, const int32_t& aEndOffset,
nsIntRect* aBounds) { LayoutDeviceIntRect* aBounds) {
HyperTextAccessibleWrap* acc = IdToHyperTextAccessibleWrap(aID); HyperTextAccessibleWrap* acc = IdToHyperTextAccessibleWrap(aID);
HyperTextAccessibleWrap* endContainer = HyperTextAccessibleWrap* endContainer =
IdToHyperTextAccessibleWrap(aEndContainer); IdToHyperTextAccessibleWrap(aEndContainer);
if (!acc || !endContainer) { if (!acc || !endContainer) {
*aBounds = nsIntRect(); *aBounds = LayoutDeviceIntRect();
return IPC_OK(); return IPC_OK();
} }

Просмотреть файл

@ -41,7 +41,7 @@ class DocAccessiblePlatformExtChild : public PDocAccessiblePlatformExtChild {
const int32_t& aStartOffset, const int32_t& aStartOffset,
const uint64_t& aEndContainer, const uint64_t& aEndContainer,
const int32_t& aEndOffset, const int32_t& aEndOffset,
nsIntRect* aBounds); LayoutDeviceIntRect* aBounds);
mozilla::ipc::IPCResult RecvLengthForRange(const uint64_t& aID, mozilla::ipc::IPCResult RecvLengthForRange(const uint64_t& aID,
const int32_t& aStartOffset, const int32_t& aStartOffset,

Просмотреть файл

@ -11,7 +11,7 @@ include "mozilla/GfxMessageUtils.h";
using mozilla::a11y::EWhichRange from "mozilla/a11y/IPCTypes.h"; using mozilla::a11y::EWhichRange from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::EWhichPostFilter from "mozilla/a11y/IPCTypes.h"; using mozilla::a11y::EWhichPostFilter from "mozilla/a11y/IPCTypes.h";
[RefCounted] using mozilla::a11y::AccAttributes from "mozilla/a11y/IPCTypes.h"; [RefCounted] using mozilla::a11y::AccAttributes from "mozilla/a11y/IPCTypes.h";
using nsIntRect from "nsRect.h"; using mozilla::LayoutDeviceIntRect from "Units.h";
namespace mozilla { namespace mozilla {
namespace a11y { namespace a11y {
@ -43,7 +43,7 @@ child:
returns(nsString aText); returns(nsString aText);
[Nested=inside_sync] sync BoundsForRange(uint64_t aID, int32_t aStartOffset, uint64_t aEndContainer, int32_t aEndOffset) [Nested=inside_sync] sync BoundsForRange(uint64_t aID, int32_t aStartOffset, uint64_t aEndContainer, int32_t aEndOffset)
returns(nsIntRect aRetVal); returns(LayoutDeviceIntRect aRetVal);
[Nested=inside_sync] sync LengthForRange(uint64_t aID, int32_t aStartOffset, uint64_t aEndContainer, int32_t aEndOffset) [Nested=inside_sync] sync LengthForRange(uint64_t aID, int32_t aStartOffset, uint64_t aEndContainer, int32_t aEndOffset)
returns(int32_t aLength); returns(int32_t aLength);

Просмотреть файл

@ -419,7 +419,7 @@ mozilla::ipc::IPCResult DocAccessibleChild::RecvDefaultTextAttributes(
mozilla::ipc::IPCResult DocAccessibleChild::RecvTextBounds( mozilla::ipc::IPCResult DocAccessibleChild::RecvTextBounds(
const uint64_t& aID, const int32_t& aStartOffset, const int32_t& aEndOffset, const uint64_t& aID, const int32_t& aStartOffset, const int32_t& aEndOffset,
const uint32_t& aCoordType, nsIntRect* aRetVal) { const uint32_t& aCoordType, LayoutDeviceIntRect* aRetVal) {
HyperTextAccessible* acc = IdToHyperTextAccessible(aID); HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (acc && acc->IsTextRole()) { if (acc && acc->IsTextRole()) {
*aRetVal = acc->TextBounds(aStartOffset, aEndOffset, aCoordType); *aRetVal = acc->TextBounds(aStartOffset, aEndOffset, aCoordType);
@ -430,7 +430,7 @@ mozilla::ipc::IPCResult DocAccessibleChild::RecvTextBounds(
mozilla::ipc::IPCResult DocAccessibleChild::RecvCharBounds( mozilla::ipc::IPCResult DocAccessibleChild::RecvCharBounds(
const uint64_t& aID, const int32_t& aOffset, const uint32_t& aCoordType, const uint64_t& aID, const int32_t& aOffset, const uint32_t& aCoordType,
nsIntRect* aRetVal) { LayoutDeviceIntRect* aRetVal) {
HyperTextAccessible* acc = IdToHyperTextAccessible(aID); HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (acc && acc->IsTextRole()) { if (acc && acc->IsTextRole()) {
*aRetVal = acc->CharBounds(aOffset, aCoordType); *aRetVal = acc->CharBounds(aOffset, aCoordType);
@ -606,7 +606,8 @@ mozilla::ipc::IPCResult DocAccessibleChild::RecvPasteText(
} }
mozilla::ipc::IPCResult DocAccessibleChild::RecvImagePosition( mozilla::ipc::IPCResult DocAccessibleChild::RecvImagePosition(
const uint64_t& aID, const uint32_t& aCoordType, nsIntPoint* aRetVal) { const uint64_t& aID, const uint32_t& aCoordType,
LayoutDeviceIntPoint* aRetVal) {
ImageAccessible* acc = IdToImageAccessible(aID); ImageAccessible* acc = IdToImageAccessible(aID);
if (acc) { if (acc) {
*aRetVal = acc->Position(aCoordType); *aRetVal = acc->Position(aCoordType);
@ -615,8 +616,8 @@ mozilla::ipc::IPCResult DocAccessibleChild::RecvImagePosition(
return IPC_OK(); return IPC_OK();
} }
mozilla::ipc::IPCResult DocAccessibleChild::RecvImageSize(const uint64_t& aID, mozilla::ipc::IPCResult DocAccessibleChild::RecvImageSize(
nsIntSize* aRetVal) { const uint64_t& aID, LayoutDeviceIntSize* aRetVal) {
ImageAccessible* acc = IdToImageAccessible(aID); ImageAccessible* acc = IdToImageAccessible(aID);
if (acc) { if (acc) {
*aRetVal = acc->Size(); *aRetVal = acc->Size();
@ -1643,10 +1644,10 @@ mozilla::ipc::IPCResult DocAccessibleChild::RecvExtents(
*aHeight = 0; *aHeight = 0;
LocalAccessible* acc = IdToAccessible(aID); LocalAccessible* acc = IdToAccessible(aID);
if (acc && !acc->IsDefunct()) { if (acc && !acc->IsDefunct()) {
nsIntRect screenRect = acc->Bounds(); LayoutDeviceIntRect screenRect = acc->Bounds();
if (!screenRect.IsEmpty()) { if (!screenRect.IsEmpty()) {
if (aNeedsScreenCoords) { if (aNeedsScreenCoords) {
nsIntPoint winCoords = LayoutDeviceIntPoint winCoords =
nsCoreUtils::GetScreenCoordsForWindow(acc->GetNode()); nsCoreUtils::GetScreenCoordsForWindow(acc->GetNode());
screenRect.x -= winCoords.x; screenRect.x -= winCoords.x;
screenRect.y -= winCoords.y; screenRect.y -= winCoords.y;

Просмотреть файл

@ -143,16 +143,14 @@ class DocAccessibleChild : public DocAccessibleChildBase {
virtual mozilla::ipc::IPCResult RecvDefaultTextAttributes( virtual mozilla::ipc::IPCResult RecvDefaultTextAttributes(
const uint64_t& aID, RefPtr<AccAttributes>* aAttributes) override; const uint64_t& aID, RefPtr<AccAttributes>* aAttributes) override;
virtual mozilla::ipc::IPCResult RecvTextBounds(const uint64_t& aID, virtual mozilla::ipc::IPCResult RecvTextBounds(
const int32_t& aStartOffset, const uint64_t& aID, const int32_t& aStartOffset,
const int32_t& aEndOffset, const int32_t& aEndOffset, const uint32_t& aCoordType,
const uint32_t& aCoordType, LayoutDeviceIntRect* aRetVal) override;
nsIntRect* aRetVal) override;
virtual mozilla::ipc::IPCResult RecvCharBounds(const uint64_t& aID, virtual mozilla::ipc::IPCResult RecvCharBounds(
const int32_t& aOffset, const uint64_t& aID, const int32_t& aOffset, const uint32_t& aCoordType,
const uint32_t& aCoordType, LayoutDeviceIntRect* aRetVal) override;
nsIntRect* aRetVal) override;
virtual mozilla::ipc::IPCResult RecvOffsetAtPoint(const uint64_t& aID, virtual mozilla::ipc::IPCResult RecvOffsetAtPoint(const uint64_t& aID,
const int32_t& aX, const int32_t& aX,
@ -219,10 +217,10 @@ class DocAccessibleChild : public DocAccessibleChildBase {
virtual mozilla::ipc::IPCResult RecvImagePosition( virtual mozilla::ipc::IPCResult RecvImagePosition(
const uint64_t& aID, const uint32_t& aCoordType, const uint64_t& aID, const uint32_t& aCoordType,
nsIntPoint* aRetVal) override; LayoutDeviceIntPoint* aRetVal) override;
virtual mozilla::ipc::IPCResult RecvImageSize(const uint64_t& aID, virtual mozilla::ipc::IPCResult RecvImageSize(
nsIntSize* aRetVal) override; const uint64_t& aID, LayoutDeviceIntSize* aRetVal) override;
virtual mozilla::ipc::IPCResult RecvStartOffset(const uint64_t& aID, virtual mozilla::ipc::IPCResult RecvStartOffset(const uint64_t& aID,
uint32_t* aRetVal, uint32_t* aRetVal,

Просмотреть файл

@ -12,14 +12,14 @@ include DocAccessibleTypes;
include "mozilla/GfxMessageUtils.h"; include "mozilla/GfxMessageUtils.h";
using nsIntRect from "nsRect.h"; using LayoutDeviceIntRect from "Units.h";
using LayoutDeviceIntPoint from "Units.h";
using LayoutDeviceIntSize from "Units.h";
using mozilla::a11y::role from "mozilla/a11y/IPCTypes.h"; using mozilla::a11y::role from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::AccType from "mozilla/a11y/IPCTypes.h"; using mozilla::a11y::AccType from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::AccGenericType from "mozilla/a11y/IPCTypes.h"; using mozilla::a11y::AccGenericType from "mozilla/a11y/IPCTypes.h";
[RefCounted] using mozilla::a11y::AccAttributes from "mozilla/a11y/IPCTypes.h"; [RefCounted] using mozilla::a11y::AccAttributes from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::CacheUpdateType from "mozilla/a11y/IPCTypes.h"; using mozilla::a11y::CacheUpdateType from "mozilla/a11y/IPCTypes.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
namespace mozilla { namespace mozilla {
namespace a11y { namespace a11y {
@ -44,7 +44,7 @@ struct BatchData
OriginDocument Document; OriginDocument Document;
uint64_t ID; uint64_t ID;
uint64_t State; uint64_t State;
nsIntRect Bounds; LayoutDeviceIntRect Bounds;
uint8_t ActionCount; uint8_t ActionCount;
nsString Name; nsString Name;
nsString TextValue; nsString TextValue;
@ -200,9 +200,9 @@ child:
[Nested=inside_sync] sync TextBounds(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset, [Nested=inside_sync] sync TextBounds(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset,
uint32_t aCoordType) uint32_t aCoordType)
returns(nsIntRect aRetVal); returns(LayoutDeviceIntRect aRetVal);
[Nested=inside_sync] sync CharBounds(uint64_t aID, int32_t aOffset, uint32_t aCoordType) [Nested=inside_sync] sync CharBounds(uint64_t aID, int32_t aOffset, uint32_t aCoordType)
returns(nsIntRect aRetVal); returns(LayoutDeviceIntRect aRetVal);
[Nested=inside_sync] sync OffsetAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aCoordType) [Nested=inside_sync] sync OffsetAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aCoordType)
returns(int32_t aRetVal); returns(int32_t aRetVal);
@ -238,8 +238,8 @@ child:
[Nested=inside_sync] sync PasteText(uint64_t aID, int32_t aPosition) [Nested=inside_sync] sync PasteText(uint64_t aID, int32_t aPosition)
returns(bool aValid); returns(bool aValid);
[Nested=inside_sync] sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(IntPoint aRetVal); [Nested=inside_sync] sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(LayoutDeviceIntPoint aRetVal);
[Nested=inside_sync] sync ImageSize(uint64_t aID) returns(IntSize aRetVal); [Nested=inside_sync] sync ImageSize(uint64_t aID) returns(LayoutDeviceIntSize aRetVal);
[Nested=inside_sync] sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk); [Nested=inside_sync] sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk);
[Nested=inside_sync] sync EndOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk); [Nested=inside_sync] sync EndOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk);

Просмотреть файл

@ -260,16 +260,18 @@ already_AddRefed<AccAttributes> RemoteAccessible::DefaultTextAttributes() {
return attrs.forget(); return attrs.forget();
} }
nsIntRect RemoteAccessible::TextBounds(int32_t aStartOffset, int32_t aEndOffset, LayoutDeviceIntRect RemoteAccessible::TextBounds(int32_t aStartOffset,
uint32_t aCoordType) { int32_t aEndOffset,
nsIntRect rect; uint32_t aCoordType) {
LayoutDeviceIntRect rect;
Unused << mDoc->SendTextBounds(mID, aStartOffset, aEndOffset, aCoordType, Unused << mDoc->SendTextBounds(mID, aStartOffset, aEndOffset, aCoordType,
&rect); &rect);
return rect; return rect;
} }
nsIntRect RemoteAccessible::CharBounds(int32_t aOffset, uint32_t aCoordType) { LayoutDeviceIntRect RemoteAccessible::CharBounds(int32_t aOffset,
nsIntRect rect; uint32_t aCoordType) {
LayoutDeviceIntRect rect;
Unused << mDoc->SendCharBounds(mID, aOffset, aCoordType, &rect); Unused << mDoc->SendCharBounds(mID, aOffset, aCoordType, &rect);
return rect; return rect;
} }
@ -365,14 +367,14 @@ bool RemoteAccessible::PasteText(int32_t aPosition) {
return valid; return valid;
} }
nsIntPoint RemoteAccessible::ImagePosition(uint32_t aCoordType) { LayoutDeviceIntPoint RemoteAccessible::ImagePosition(uint32_t aCoordType) {
nsIntPoint retVal; LayoutDeviceIntPoint retVal;
Unused << mDoc->SendImagePosition(mID, aCoordType, &retVal); Unused << mDoc->SendImagePosition(mID, aCoordType, &retVal);
return retVal; return retVal;
} }
nsIntSize RemoteAccessible::ImageSize() { LayoutDeviceIntSize RemoteAccessible::ImageSize() {
nsIntSize retVal; LayoutDeviceIntSize retVal;
Unused << mDoc->SendImageSize(mID, &retVal); Unused << mDoc->SendImageSize(mID, &retVal);
return retVal; return retVal;
} }
@ -872,7 +874,7 @@ Accessible* RemoteAccessible::ChildAtPoint(
if (target->IsOuterDoc()) { if (target->IsOuterDoc()) {
if (target->ChildCount() == 0) { if (target->ChildCount() == 0) {
// Return the OuterDoc if the requested point is within its bounds. // Return the OuterDoc if the requested point is within its bounds.
nsIntRect rect = target->Bounds(); LayoutDeviceIntRect rect = target->Bounds();
if (rect.Contains(aX, aY)) { if (rect.Contains(aX, aY)) {
return target; return target;
} }
@ -885,7 +887,7 @@ Accessible* RemoteAccessible::ChildAtPoint(
// process, so they stop at OOP iframes. // process, so they stop at OOP iframes.
if (aWhichChild == Accessible::EWhichChildAtPoint::DirectChild) { if (aWhichChild == Accessible::EWhichChildAtPoint::DirectChild) {
// Return the child document if it's within the bounds of the iframe. // Return the child document if it's within the bounds of the iframe.
nsIntRect docRect = target->Bounds(); LayoutDeviceIntRect docRect = target->Bounds();
if (docRect.Contains(aX, aY)) { if (docRect.Contains(aX, aY)) {
return childDoc; return childDoc;
} }
@ -908,12 +910,12 @@ Accessible* RemoteAccessible::ChildAtPoint(
return target; return target;
} }
nsIntRect RemoteAccessible::Bounds() const { LayoutDeviceIntRect RemoteAccessible::Bounds() const {
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) { if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
return RemoteAccessibleBase<RemoteAccessible>::Bounds(); return RemoteAccessibleBase<RemoteAccessible>::Bounds();
} }
nsIntRect rect; LayoutDeviceIntRect rect;
Unused << mDoc->SendExtents(mID, false, &(rect.x), &(rect.y), &(rect.width), Unused << mDoc->SendExtents(mID, false, &(rect.x), &(rect.y), &(rect.width),
&(rect.height)); &(rect.height));
return rect; return rect;

Просмотреть файл

@ -223,12 +223,12 @@ uint64_t RemoteAccessible::State() {
return state; return state;
} }
nsIntRect RemoteAccessible::Bounds() const { LayoutDeviceIntRect RemoteAccessible::Bounds() const {
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) { if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
return RemoteAccessibleBase<RemoteAccessible>::Bounds(); return RemoteAccessibleBase<RemoteAccessible>::Bounds();
} }
nsIntRect rect; LayoutDeviceIntRect rect;
RefPtr<IAccessible> acc; RefPtr<IAccessible> acc;
if (!GetCOMInterface((void**)getter_AddRefs(acc))) { if (!GetCOMInterface((void**)getter_AddRefs(acc))) {

Просмотреть файл

@ -530,7 +530,7 @@ int32_t GeckoTextMarkerRange::Length() const {
} }
NSValue* GeckoTextMarkerRange::Bounds() const { NSValue* GeckoTextMarkerRange::Bounds() const {
nsIntRect rect; LayoutDeviceIntRect rect;
if (mStart.mContainer->IsRemote() && mEnd.mContainer->IsRemote()) { if (mStart.mContainer->IsRemote() && mEnd.mContainer->IsRemote()) {
DocAccessibleParent* ipcDoc = mStart.mContainer->AsRemote()->Document(); DocAccessibleParent* ipcDoc = mStart.mContainer->AsRemote()->Document();
Unused << ipcDoc->GetPlatformExtension()->SendBoundsForRange( Unused << ipcDoc->GetPlatformExtension()->SendBoundsForRange(

Просмотреть файл

@ -29,9 +29,9 @@ class HyperTextAccessibleWrap : public HyperTextAccessible {
HyperTextAccessible* aEndContainer, HyperTextAccessible* aEndContainer,
int32_t aEndOffset); int32_t aEndOffset);
nsIntRect BoundsForRange(int32_t aStartOffset, LayoutDeviceIntRect BoundsForRange(int32_t aStartOffset,
HyperTextAccessible* aEndContainer, HyperTextAccessible* aEndContainer,
int32_t aEndOffset); int32_t aEndOffset);
int32_t LengthForRange(int32_t aStartOffset, int32_t LengthForRange(int32_t aStartOffset,
HyperTextAccessible* aEndContainer, HyperTextAccessible* aEndContainer,

Просмотреть файл

@ -313,13 +313,13 @@ void HyperTextAccessibleWrap::AttributedTextForRange(
} }
} }
nsIntRect HyperTextAccessibleWrap::BoundsForRange( LayoutDeviceIntRect HyperTextAccessibleWrap::BoundsForRange(
int32_t aStartOffset, HyperTextAccessible* aEndContainer, int32_t aStartOffset, HyperTextAccessible* aEndContainer,
int32_t aEndOffset) { int32_t aEndOffset) {
nsIntRect rect; LayoutDeviceIntRect rect;
HyperTextIterator iter(this, aStartOffset, aEndContainer, aEndOffset); HyperTextIterator iter(this, aStartOffset, aEndContainer, aEndOffset);
while (iter.Next()) { while (iter.Next()) {
nsIntRect stringRect = iter.mCurrentContainer->TextBounds( LayoutDeviceIntRect stringRect = iter.mCurrentContainer->TextBounds(
iter.mCurrentStartOffset, iter.mCurrentEndOffset); iter.mCurrentStartOffset, iter.mCurrentEndOffset);
rect.UnionRect(rect, stringRect); rect.UnionRect(rect, stringRect);
} }

Просмотреть файл

@ -689,9 +689,9 @@ struct RoleDescrComparator {
- (NSValue*)moxFrame { - (NSValue*)moxFrame {
MOZ_ASSERT(mGeckoAccessible); MOZ_ASSERT(mGeckoAccessible);
nsIntRect rect = mGeckoAccessible->IsLocal() LayoutDeviceIntRect rect = mGeckoAccessible->IsLocal()
? mGeckoAccessible->AsLocal()->Bounds() ? mGeckoAccessible->AsLocal()->Bounds()
: mGeckoAccessible->AsRemote()->Bounds(); : mGeckoAccessible->AsRemote()->Bounds();
NSScreen* mainView = [[NSScreen screens] objectAtIndex:0]; NSScreen* mainView = [[NSScreen screens] objectAtIndex:0];
CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mainView); CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mainView);
@ -906,12 +906,11 @@ struct RoleDescrComparator {
- (void)moxPerformShowMenu { - (void)moxPerformShowMenu {
MOZ_ASSERT(mGeckoAccessible); MOZ_ASSERT(mGeckoAccessible);
nsIntRect bounds = mGeckoAccessible->IsLocal()
? mGeckoAccessible->AsLocal()->Bounds()
: mGeckoAccessible->AsRemote()->Bounds();
// We don't need to convert this rect into mac coordinates because the // We don't need to convert this rect into mac coordinates because the
// mouse event synthesizer expects layout (gecko) coordinates. // mouse event synthesizer expects layout (gecko) coordinates.
LayoutDeviceIntRect geckoRect = LayoutDeviceIntRect::FromUnknownRect(bounds); LayoutDeviceIntRect bounds = mGeckoAccessible->IsLocal()
? mGeckoAccessible->AsLocal()->Bounds()
: mGeckoAccessible->AsRemote()->Bounds();
LocalAccessible* rootAcc = mGeckoAccessible->IsLocal() LocalAccessible* rootAcc = mGeckoAccessible->IsLocal()
? mGeckoAccessible->AsLocal()->RootAccessible() ? mGeckoAccessible->AsLocal()->RootAccessible()
@ -921,9 +920,8 @@ struct RoleDescrComparator {
id objOrView = id objOrView =
GetObjectOrRepresentedView(GetNativeFromGeckoAccessible(rootAcc)); GetObjectOrRepresentedView(GetNativeFromGeckoAccessible(rootAcc));
LayoutDeviceIntPoint p = LayoutDeviceIntPoint p = LayoutDeviceIntPoint(
LayoutDeviceIntPoint(geckoRect.X() + (geckoRect.Width() / 2), bounds.X() + (bounds.Width() / 2), bounds.Y() + (bounds.Height() / 2));
geckoRect.Y() + (geckoRect.Height() / 2));
nsIWidget* widget = [objOrView widget]; nsIWidget* widget = [objOrView widget];
widget->SynthesizeNativeMouseEvent( widget->SynthesizeNativeMouseEvent(
p, nsIWidget::NativeMouseMessage::ButtonDown, MouseButton::eSecondary, p, nsIWidget::NativeMouseMessage::ButtonDown, MouseButton::eSecondary,

Просмотреть файл

@ -54,7 +54,7 @@ ia2AccessibleComponent::get_locationInParent(long* aX, long* aY) {
uint64_t state = acc->State(); uint64_t state = acc->State();
if (state & states::INVISIBLE) return S_OK; if (state & states::INVISIBLE) return S_OK;
nsIntRect rect = acc->Bounds(); LayoutDeviceIntRect rect = acc->Bounds();
// The coordinates of the returned position are relative to this object's // The coordinates of the returned position are relative to this object's
// parent or relative to the screen on which this object is rendered if it // parent or relative to the screen on which this object is rendered if it
@ -67,7 +67,7 @@ ia2AccessibleComponent::get_locationInParent(long* aX, long* aY) {
// The coordinates of the bounding box are given relative to the parent's // The coordinates of the bounding box are given relative to the parent's
// coordinate system. // coordinate system.
nsIntRect parentRect = acc->LocalParent()->Bounds(); LayoutDeviceIntRect parentRect = acc->LocalParent()->Bounds();
*aX = rect.X() - parentRect.X(); *aX = rect.X() - parentRect.X();
*aY = rect.Y() - parentRect.Y(); *aY = rect.Y() - parentRect.Y();
return S_OK; return S_OK;

Просмотреть файл

@ -63,7 +63,7 @@ ia2AccessibleImage::get_imagePosition(enum IA2CoordinateType aCoordType,
? nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE ? nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE
: nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE; : nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
nsIntPoint pos = imageAcc->Position(geckoCoordType); LayoutDeviceIntPoint pos = imageAcc->Position(geckoCoordType);
*aX = pos.x; *aX = pos.x;
*aY = pos.y; *aY = pos.y;
return S_OK; return S_OK;
@ -79,7 +79,7 @@ ia2AccessibleImage::get_imageSize(long* aHeight, long* aWidth) {
ImageAccessible* imageAcc = ImageAcc(); ImageAccessible* imageAcc = ImageAcc();
if (!imageAcc) return CO_E_OBJNOTCONNECTED; if (!imageAcc) return CO_E_OBJNOTCONNECTED;
nsIntSize size = imageAcc->Size(); LayoutDeviceIntSize size = imageAcc->Size();
*aHeight = size.width; *aHeight = size.width;
*aWidth = size.height; *aWidth = size.height;
return S_OK; return S_OK;

Просмотреть файл

@ -111,7 +111,7 @@ ia2AccessibleText::get_characterExtents(long aOffset,
(aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE)
? nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE ? nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE
: nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE; : nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
nsIntRect rect; LayoutDeviceIntRect rect;
auto [textAcc, hr] = LocalTextAcc(); auto [textAcc, hr] = LocalTextAcc();
if (!textAcc) { if (!textAcc) {
return hr; return hr;

Просмотреть файл

@ -77,10 +77,10 @@ void DocAccessibleWrap::DoInitialUpdate() {
MOZ_ASSERT(XRE_IsParentProcess()); MOZ_ASSERT(XRE_IsParentProcess());
a11y::RootAccessible* rootDocument = RootAccessible(); a11y::RootAccessible* rootDocument = RootAccessible();
bool isActive = true; bool isActive = true;
nsIntRect rect(CW_USEDEFAULT, CW_USEDEFAULT, 0, 0); LayoutDeviceIntRect rect(CW_USEDEFAULT, CW_USEDEFAULT, 0, 0);
if (Compatibility::IsDolphin()) { if (Compatibility::IsDolphin()) {
rect = Bounds(); rect = Bounds();
nsIntRect rootRect = rootDocument->Bounds(); LayoutDeviceIntRect rootRect = rootDocument->Bounds();
rect.MoveToX(rootRect.X() - rect.X()); rect.MoveToX(rootRect.X() - rect.X());
rect.MoveByY(-rootRect.Y()); rect.MoveByY(-rootRect.Y());

Просмотреть файл

@ -1523,7 +1523,7 @@ MsaaAccessible::accLocation(
kVarChildIdSelf); kVarChildIdSelf);
} }
nsIntRect rect = Acc()->Bounds(); LayoutDeviceIntRect rect = Acc()->Bounds();
*pxLeft = rect.X(); *pxLeft = rect.X();
*pyTop = rect.Y(); *pyTop = rect.Y();
*pcxWidth = rect.Width(); *pcxWidth = rect.Width();
@ -1654,7 +1654,7 @@ MsaaAccessible::accHitTest(
// This is an OOP iframe. ChildAtPoint can't traverse inside it. If the // This is an OOP iframe. ChildAtPoint can't traverse inside it. If the
// coordinates are inside this iframe, return the COM proxy for the // coordinates are inside this iframe, return the COM proxy for the
// OOP document. // OOP document.
nsIntRect docRect = mAcc->AsLocal()->Bounds(); LayoutDeviceIntRect docRect = mAcc->AsLocal()->Bounds();
if (docRect.Contains(xLeft, yTop)) { if (docRect.Contains(xLeft, yTop)) {
pvarChild->vt = VT_DISPATCH; pvarChild->vt = VT_DISPATCH;
disp.forget(&pvarChild->pdispVal); disp.forget(&pvarChild->pdispVal);

Просмотреть файл

@ -61,10 +61,10 @@ sdnTextAccessible::get_clippedSubstringBounds(
document, document,
"There must always be a doc accessible, but there isn't. Crash!"); "There must always be a doc accessible, but there isn't. Crash!");
nsIntRect docRect = document->Bounds(); LayoutDeviceIntRect docRect = document->Bounds();
nsIntRect unclippedRect(x, y, width, height); LayoutDeviceIntRect unclippedRect(x, y, width, height);
nsIntRect clippedRect; LayoutDeviceIntRect clippedRect;
clippedRect.IntersectRect(unclippedRect, docRect); clippedRect.IntersectRect(unclippedRect, docRect);
*aX = clippedRect.X(); *aX = clippedRect.X();

Просмотреть файл

@ -408,7 +408,7 @@ xpcAccessible::GetBounds(int32_t* aX, int32_t* aY, int32_t* aWidth,
if (!IntlGeneric()) return NS_ERROR_FAILURE; if (!IntlGeneric()) return NS_ERROR_FAILURE;
nsIntRect rect; LayoutDeviceIntRect rect;
if (LocalAccessible* acc = IntlGeneric()->AsLocal()) { if (LocalAccessible* acc = IntlGeneric()->AsLocal()) {
rect = acc->Bounds(); rect = acc->Bounds();
} else { } else {

Просмотреть файл

@ -231,7 +231,7 @@ xpcAccessibleHyperText::GetCharacterExtents(int32_t aOffset, int32_t* aX,
if (!mIntl) return NS_ERROR_FAILURE; if (!mIntl) return NS_ERROR_FAILURE;
nsIntRect rect; LayoutDeviceIntRect rect;
if (mIntl->IsLocal()) { if (mIntl->IsLocal()) {
rect = IntlLocal()->CharBounds(aOffset, aCoordType); rect = IntlLocal()->CharBounds(aOffset, aCoordType);
} else { } else {
@ -258,7 +258,7 @@ xpcAccessibleHyperText::GetRangeExtents(int32_t aStartOffset,
if (!mIntl) return NS_ERROR_FAILURE; if (!mIntl) return NS_ERROR_FAILURE;
nsIntRect rect; LayoutDeviceIntRect rect;
if (mIntl->IsLocal()) { if (mIntl->IsLocal()) {
rect = IntlLocal()->TextBounds(aStartOffset, aEndOffset, aCoordType); rect = IntlLocal()->TextBounds(aStartOffset, aEndOffset, aCoordType);
} else { } else {

Просмотреть файл

@ -29,7 +29,7 @@ xpcAccessibleImage::GetImagePosition(uint32_t aCoordType, int32_t* aX,
if (!Intl()) return NS_ERROR_FAILURE; if (!Intl()) return NS_ERROR_FAILURE;
nsIntPoint point = Intl()->Position(aCoordType); LayoutDeviceIntPoint point = Intl()->Position(aCoordType);
*aX = point.x; *aX = point.x;
*aY = point.y; *aY = point.y;
return NS_OK; return NS_OK;
@ -44,7 +44,7 @@ xpcAccessibleImage::GetImageSize(int32_t* aWidth, int32_t* aHeight) {
if (!Intl()) return NS_ERROR_FAILURE; if (!Intl()) return NS_ERROR_FAILURE;
nsIntSize size = Intl()->Size(); LayoutDeviceIntSize size = Intl()->Size();
*aWidth = size.width; *aWidth = size.width;
*aHeight = size.height; *aHeight = size.height;
return NS_OK; return NS_OK;