From a62e6ee5b73d17a75aa14eaf3bcdce05f6e39a6f Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 12 Nov 2015 05:34:27 -0800 Subject: [PATCH] Bug 1224403 (part 8) - Use LayoutDeviceIntMargin more in HyperTextAccessible. r=kats. --HG-- extra : rebase_source : 0e3cf7566f640f3165d677f67c005b43e290ac94 --- accessible/generic/HyperTextAccessible.cpp | 16 ++++++++-------- accessible/generic/HyperTextAccessible.h | 2 +- accessible/windows/msaa/AccessibleWrap.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/accessible/generic/HyperTextAccessible.cpp b/accessible/generic/HyperTextAccessible.cpp index 4f3152a46ccf..76b8fe49caa9 100644 --- a/accessible/generic/HyperTextAccessible.cpp +++ b/accessible/generic/HyperTextAccessible.cpp @@ -1494,34 +1494,34 @@ HyperTextAccessible::CaretLineNumber() return lineNumber; } -nsIntRect +LayoutDeviceIntRect HyperTextAccessible::GetCaretRect(nsIWidget** aWidget) { *aWidget = nullptr; RefPtr caret = mDoc->PresShell()->GetCaret(); - NS_ENSURE_TRUE(caret, nsIntRect()); + NS_ENSURE_TRUE(caret, LayoutDeviceIntRect()); bool isVisible = caret->IsVisible(); if (!isVisible) - return nsIntRect(); + return LayoutDeviceIntRect(); nsRect rect; nsIFrame* frame = caret->GetGeometry(&rect); if (!frame || rect.IsEmpty()) - return nsIntRect(); + return LayoutDeviceIntRect(); nsPoint offset; // Offset from widget origin to the frame origin, which includes chrome // on the widget. *aWidget = frame->GetNearestWidget(offset); - NS_ENSURE_TRUE(*aWidget, nsIntRect()); + NS_ENSURE_TRUE(*aWidget, LayoutDeviceIntRect()); rect.MoveBy(offset); - nsIntRect caretRect; - caretRect = rect.ToOutsidePixels(frame->PresContext()->AppUnitsPerDevPixel()); + LayoutDeviceIntRect caretRect = LayoutDeviceIntRect::FromUnknownRect( + rect.ToOutsidePixels(frame->PresContext()->AppUnitsPerDevPixel())); // ((content screen origin) - (content offset in the widget)) = widget origin on the screen - caretRect.MoveBy((*aWidget)->WidgetToScreenOffsetUntyped() - (*aWidget)->GetClientOffsetUntyped()); + caretRect.MoveBy((*aWidget)->WidgetToScreenOffset() - (*aWidget)->GetClientOffset()); // Correct for character size, so that caret always matches the size of // the character. This is important for font size transitions, and is diff --git a/accessible/generic/HyperTextAccessible.h b/accessible/generic/HyperTextAccessible.h index 524276caf7f3..b6ba2ee5d2d8 100644 --- a/accessible/generic/HyperTextAccessible.h +++ b/accessible/generic/HyperTextAccessible.h @@ -335,7 +335,7 @@ public: * @param [out] the widget containing the caret * @return the caret rect */ - nsIntRect GetCaretRect(nsIWidget** aWidget); + mozilla::LayoutDeviceIntRect GetCaretRect(nsIWidget** aWidget); /** * Return selected regions count within the accessible. diff --git a/accessible/windows/msaa/AccessibleWrap.cpp b/accessible/windows/msaa/AccessibleWrap.cpp index fd3c07161226..6ac115167b0d 100644 --- a/accessible/windows/msaa/AccessibleWrap.cpp +++ b/accessible/windows/msaa/AccessibleWrap.cpp @@ -1633,7 +1633,7 @@ AccessibleWrap::UpdateSystemCaretFor(Accessible* aAccessible) return; nsIWidget* widget = nullptr; - nsIntRect caretRect = text->GetCaretRect(&widget); + LayoutDeviceIntRect caretRect = text->GetCaretRect(&widget); HWND caretWnd; if (caretRect.IsEmpty() || !(caretWnd = (HWND)widget->GetNativeData(NS_NATIVE_WINDOW))) { return;