mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1224403 (part 8) - Use LayoutDeviceIntMargin more in HyperTextAccessible. r=kats.
--HG-- extra : rebase_source : 0e3cf7566f640f3165d677f67c005b43e290ac94
This commit is contained in:
parent
a63371ae36
commit
a62e6ee5b7
@ -1494,34 +1494,34 @@ HyperTextAccessible::CaretLineNumber()
|
||||
return lineNumber;
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
LayoutDeviceIntRect
|
||||
HyperTextAccessible::GetCaretRect(nsIWidget** aWidget)
|
||||
{
|
||||
*aWidget = nullptr;
|
||||
|
||||
RefPtr<nsCaret> 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
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user