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
Родитель 8508eb2c77
Коммит 57c2acce79
48 изменённых файлов: 222 добавлений и 204 удалений

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

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

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

@ -55,7 +55,7 @@ class AccessibleWrap : public LocalAccessible {
mozilla::java::GeckoBundle::LocalRef ToBundle(bool aSmall = false);
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 nsString& aTextValue, const nsString& aDOMNodeID,
const nsString& aDescription,

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

@ -74,7 +74,9 @@ void RemoteAccessibleWrap::Value(nsString& aValue) const {
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 {
Proxy()->ScrollTo(aHow);

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

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

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

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

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

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

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

@ -323,7 +323,7 @@ static void getCharacterExtentsCB(AtkText* aText, gint aOffset, gint* aX,
}
*aX = *aY = *aWidth = *aHeight = -1;
nsIntRect rect;
LayoutDeviceIntRect rect;
uint32_t geckoCoordType;
if (aCoords == ATK_XY_SCREEN) {
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;
@ -359,7 +359,7 @@ static void getRangeExtentsCB(AtkText* aText, gint aStartOffset,
}
aRect->x = aRect->y = aRect->width = aRect->height = -1;
nsIntRect rect;
LayoutDeviceIntRect rect;
uint32_t geckoCoordType;
if (aCoords == ATK_XY_SCREEN) {
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
if ((filtered & nsIAccessibleTraversalRule::FILTER_MATCH) && !match) {
nsIntRect childRect = child->IsLocal() ? child->AsLocal()->Bounds()
: child->AsRemote()->Bounds();
LayoutDeviceIntRect childRect = child->IsLocal()
? child->AsLocal()->Bounds()
: child->AsRemote()->Bounds();
// Double-check child's bounds since the deepest child may have been out
// of bounds. This assures we don't return a false positive.
if (childRect.Contains(aX, aY)) {

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

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

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

@ -131,24 +131,24 @@ class nsAccUtils {
/**
* Converts the given coordinates to coordinates relative screen.
*
* @param aX [in] the given x coord
* @param aY [in] the given y coord
* @param aX [in] the given x coord in dev pixels
* @param aY [in] the given y coord in dev pixels
* @param aCoordinateType [in] specifies coordinates origin (refer to
* nsIAccessibleCoordinateType)
* @param aAccessible [in] the accessible if coordinates are given
* relative it.
* @return converted coordinates
*/
static nsIntPoint ConvertToScreenCoords(int32_t aX, int32_t aY,
uint32_t aCoordinateType,
LocalAccessible* aAccessible);
static LayoutDeviceIntPoint ConvertToScreenCoords(
int32_t aX, int32_t aY, uint32_t aCoordinateType,
LocalAccessible* aAccessible);
/**
* Converts the given coordinates relative screen to another coordinate
* system.
*
* @param aX [in, out] the given x coord
* @param aY [in, out] the given y coord
* @param aX [in, out] the given x coord in dev pixels
* @param aY [in, out] the given y coord in dev pixels
* @param aCoordinateType [in] specifies coordinates origin (refer to
* nsIAccessibleCoordinateType)
* @param aAccessible [in] the accessible if coordinates are given
@ -159,11 +159,13 @@ class nsAccUtils {
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
*/
static nsIntPoint GetScreenCoordsForParent(LocalAccessible* aAccessible);
static LayoutDeviceIntPoint GetScreenCoordsForParent(
LocalAccessible* aAccessible);
/**
* 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,
nsIFrame* aFrame,
const nsIntPoint& aPoint) {
const LayoutDeviceIntPoint& aPoint) {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aScrollableFrame);
if (!scrollableFrame) return;
nsPoint point =
ToAppUnits(aPoint, aFrame->PresContext()->AppUnitsPerDevPixel());
nsPoint point = LayoutDeviceIntPoint::ToAppUnits(
aPoint, aFrame->PresContext()->AppUnitsPerDevPixel());
nsRect frameRect = aFrame->GetScreenRectInAppUnits();
nsPoint deltaPoint = point - frameRect.TopLeft();
@ -322,8 +322,8 @@ void nsCoreUtils::ConvertScrollTypeToPercents(uint32_t aScrollType,
*aHorizontal = ScrollAxis(whereX, whenX);
}
nsIntPoint nsCoreUtils::GetScreenCoordsForWindow(nsINode* aNode) {
nsIntPoint coords(0, 0);
LayoutDeviceIntPoint nsCoreUtils::GetScreenCoordsForWindow(nsINode* aNode) {
LayoutDeviceIntPoint coords(0, 0);
nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShellFor(aNode));
if (!treeItem) return coords;

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

@ -14,6 +14,7 @@
#include "nsPoint.h"
#include "nsTArray.h"
#include "Units.h"
class nsRange;
class nsTreeColumn;
@ -167,10 +168,10 @@ class nsCoreUtils {
*
* @param aScrollableFrame the scrollable frame
* @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,
const nsIntPoint& aPoint);
const mozilla::LayoutDeviceIntPoint& aPoint);
/**
* Converts scroll type constant defined in nsIAccessibleScrollType to
@ -186,7 +187,7 @@ class nsCoreUtils {
*
* @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.

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

@ -10,6 +10,7 @@
#include "mozilla/a11y/AccTypes.h"
#include "nsString.h"
#include "nsRect.h"
#include "Units.h"
class nsAtom;
@ -157,7 +158,10 @@ class Accessible {
virtual double MaxValue() 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

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

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

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

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

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

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

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

@ -184,18 +184,19 @@ class HyperTextAccessible : public AccessibleWrap,
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,
uint32_t aCoordType =
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE);
/**
* Return a rect for character at given offset relative given coordinate
* system.
* Return a rect (in dev pixels) for character at given offset relative given
* 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())
? aOffset
: aOffset + 1;
@ -394,11 +395,13 @@ class HyperTextAccessible : public AccessibleWrap,
EWordMovementType aWordMovementType = eDefaultBehavior);
/**
* Return the boundaries of the substring in case of textual frame or
* frame boundaries in case of non textual frame, offsets are ignored.
* Return the boundaries (in dev pixels) of the substring in case of textual
* frame or frame boundaries in case of non textual frame, offsets are
* ignored.
*/
nsIntRect GetBoundsInFrame(nsIFrame* aFrame, uint32_t aStartRenderedOffset,
uint32_t aEndRenderedOffset);
LayoutDeviceIntRect GetBoundsInFrame(nsIFrame* aFrame,
uint32_t aStartRenderedOffset,
uint32_t aEndRenderedOffset);
// Selection helpers

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

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

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

@ -37,8 +37,8 @@ class ImageAccessible : public LinkableAccessible,
virtual bool DoAction(uint8_t aIndex) const override;
// ImageAccessible
nsIntPoint Position(uint32_t aCoordType);
nsIntSize Size();
LayoutDeviceIntPoint Position(uint32_t aCoordType);
LayoutDeviceIntSize Size();
protected:
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:
// we return |this| if the point is within it, otherwise nullptr.
LocalAccessible* fallbackAnswer = nullptr;
nsIntRect rect = Bounds();
LayoutDeviceIntRect rect = Bounds();
if (rect.Contains(aX, aY)) fallbackAnswer = this;
if (nsAccUtils::MustPrune(this)) { // Do not dig any further
@ -611,7 +611,7 @@ LocalAccessible* LocalAccessible::LocalChildAtPoint(
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
LocalAccessible* child = accessible->LocalChildAt(childIdx);
nsIntRect childRect = child->Bounds();
LayoutDeviceIntRect childRect = child->Bounds();
if (childRect.Contains(aX, aY) &&
(child->State() & states::INVISIBLE) == 0) {
if (aWhichChild == EWhichChildAtPoint::DeepestChild) {
@ -786,9 +786,9 @@ nsRect LocalAccessible::BoundsInAppUnits() const {
return unionRectTwips;
}
nsIntRect LocalAccessible::Bounds() const {
return BoundsInAppUnits().ToNearestPixels(
mDoc->PresContext()->AppUnitsPerDevPixel());
LayoutDeviceIntRect LocalAccessible::Bounds() const {
return LayoutDeviceIntRect::FromAppUnitsToNearest(
BoundsInAppUnits(), mDoc->PresContext()->AppUnitsPerDevPixel());
}
nsIntRect LocalAccessible::BoundsInCSSPixels() const {
@ -2296,7 +2296,7 @@ void LocalAccessible::ScrollToPoint(uint32_t aCoordinateType, int32_t aX,
nsIFrame* frame = GetFrame();
if (!frame) return;
nsIntPoint coords =
LayoutDeviceIntPoint coords =
nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType, this);
nsIFrame* parentFrame = frame;

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

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

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

@ -77,7 +77,7 @@ role OuterDocAccessible::NativeRole() const { return roles::INTERNAL_FRAME; }
LocalAccessible* OuterDocAccessible::LocalChildAtPoint(
int32_t aX, int32_t aY, EWhichChildAtPoint aWhichChild) {
nsIntRect docRect = Bounds();
LayoutDeviceIntRect docRect = Bounds();
if (!docRect.Contains(aX, aY)) return nullptr;
// 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,
EWhichChildAtPoint aWhichChild) {
nsIntRect docRect = Bounds();
LayoutDeviceIntRect docRect = Bounds();
if (!docRect.Contains(aX, aY)) return nullptr;
// 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
LocalAccessible* listAcc = LocalParent();
if (listAcc) {
nsIntRect optionRect = Bounds();
nsIntRect listRect = listAcc->Bounds();
LayoutDeviceIntRect optionRect = Bounds();
LayoutDeviceIntRect listRect = listAcc->Bounds();
if (optionRect.Y() < listRect.Y() ||
optionRect.YMost() > listRect.YMost()) {
state |= states::OFFSCREEN;

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -11,7 +11,7 @@ include "mozilla/GfxMessageUtils.h";
using mozilla::a11y::EWhichRange from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::EWhichPostFilter 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 a11y {
@ -43,7 +43,7 @@ child:
returns(nsString aText);
[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)
returns(int32_t aLength);

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

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

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

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

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

@ -12,14 +12,14 @@ include DocAccessibleTypes;
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::AccType from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::AccGenericType 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::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
namespace mozilla {
namespace a11y {
@ -44,7 +44,7 @@ struct BatchData
OriginDocument Document;
uint64_t ID;
uint64_t State;
nsIntRect Bounds;
LayoutDeviceIntRect Bounds;
uint8_t ActionCount;
nsString Name;
nsString TextValue;
@ -200,9 +200,9 @@ child:
[Nested=inside_sync] sync TextBounds(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset,
uint32_t aCoordType)
returns(nsIntRect aRetVal);
returns(LayoutDeviceIntRect aRetVal);
[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)
returns(int32_t aRetVal);
@ -238,8 +238,8 @@ child:
[Nested=inside_sync] sync PasteText(uint64_t aID, int32_t aPosition)
returns(bool aValid);
[Nested=inside_sync] sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(IntPoint aRetVal);
[Nested=inside_sync] sync ImageSize(uint64_t aID) returns(IntSize aRetVal);
[Nested=inside_sync] sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(LayoutDeviceIntPoint 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 EndOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk);

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

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

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

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

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

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

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

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

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

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

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

@ -689,9 +689,9 @@ struct RoleDescrComparator {
- (NSValue*)moxFrame {
MOZ_ASSERT(mGeckoAccessible);
nsIntRect rect = mGeckoAccessible->IsLocal()
? mGeckoAccessible->AsLocal()->Bounds()
: mGeckoAccessible->AsRemote()->Bounds();
LayoutDeviceIntRect rect = mGeckoAccessible->IsLocal()
? mGeckoAccessible->AsLocal()->Bounds()
: mGeckoAccessible->AsRemote()->Bounds();
NSScreen* mainView = [[NSScreen screens] objectAtIndex:0];
CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mainView);
@ -906,12 +906,11 @@ struct RoleDescrComparator {
- (void)moxPerformShowMenu {
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
// 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()
? mGeckoAccessible->AsLocal()->RootAccessible()
@ -921,9 +920,8 @@ struct RoleDescrComparator {
id objOrView =
GetObjectOrRepresentedView(GetNativeFromGeckoAccessible(rootAcc));
LayoutDeviceIntPoint p =
LayoutDeviceIntPoint(geckoRect.X() + (geckoRect.Width() / 2),
geckoRect.Y() + (geckoRect.Height() / 2));
LayoutDeviceIntPoint p = LayoutDeviceIntPoint(
bounds.X() + (bounds.Width() / 2), bounds.Y() + (bounds.Height() / 2));
nsIWidget* widget = [objOrView widget];
widget->SynthesizeNativeMouseEvent(
p, nsIWidget::NativeMouseMessage::ButtonDown, MouseButton::eSecondary,

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

@ -54,7 +54,7 @@ ia2AccessibleComponent::get_locationInParent(long* aX, long* aY) {
uint64_t state = acc->State();
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
// 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
// coordinate system.
nsIntRect parentRect = acc->LocalParent()->Bounds();
LayoutDeviceIntRect parentRect = acc->LocalParent()->Bounds();
*aX = rect.X() - parentRect.X();
*aY = rect.Y() - parentRect.Y();
return S_OK;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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