Closed Bug 891468 Opened 11 years ago Closed 11 years ago

Convert nsEventStateManager::GetChildProcessOffset to return a LayoutDeviceIntPoint instead of an nsIntPoint

Categories

(Core :: DOM: Events, defect)

25 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: kats, Assigned: botond)

References

Details

Attachments

(1 file, 2 obsolete files)

nsEventStateManager::GetChildProcessOffset returns a generic nsIntPoint that is really in the LayoutDevice coordinate space. The nsIntPoint should be changed to a LayoutDeviceIntPoint and propagated as much as is reasonable.

As part of this, we'll probably want to add a helper function to the LayoutDevicePixel struct in layout/base/Units.h with the signature "static LayoutDeviceIntPoint FromAppUnitsToNearest(const nsPoint& aPoint, int32_t appUnitsPerDevPixel)" and use it when converting from app units to the LayoutDevice coordinate space.

It probably also makes sense to convert the first argument to nsEventStateManager::MapEventCoordinatesForChildProcess in this bug as well, but leave nsEvent::refPoint as an nsIntPoint for now.
Version: 24 Branch → 25 Branch
Attached patch patch (obsolete) — Splinter Review
Comment on attachment 772841 [details] [diff] [review]
patch

Review of attachment 772841 [details] [diff] [review]:
-----------------------------------------------------------------

Looks fine to me, requesting smaug to review this since I'm not actually a peer for this code.

::: content/events/src/nsEventStateManager.cpp
@@ +1539,5 @@
>  
>    // Find out how far we're offset from the nearest widget.
>    nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(&aEvent,
>                                                              targetFrame);
> +  return LayoutDevicePixel::FromAppUnitsToNearest(pt, presContext->AppUnitsPerDevPixel());

This works fine but for consistency with other pieces of similar code I've written, I would use "LayoutDeviceIntPoint::FromAppUnitsToNearest" here instead of "LayoutDevicePixel::FromAppUnitsToNearest".
Attachment #772841 - Flags: review?(bugs)
Attachment #772841 - Flags: feedback+
Attached patch updated patch (obsolete) — Splinter Review
Attachment #772841 - Attachment is obsolete: true
Attachment #772841 - Flags: review?(bugs)
Attachment #772854 - Flags: review?(bugs)
> ::: content/events/src/nsEventStateManager.cpp
> @@ +1539,5 @@
> >  
> >    // Find out how far we're offset from the nearest widget.
> >    nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(&aEvent,
> >                                                              targetFrame);
> > +  return LayoutDevicePixel::FromAppUnitsToNearest(pt, presContext->AppUnitsPerDevPixel());
> 
> This works fine but for consistency with other pieces of similar code I've
> written, I would use "LayoutDeviceIntPoint::FromAppUnitsToNearest" here
> instead of "LayoutDevicePixel::FromAppUnitsToNearest".

Changed in updated patch,
Attached patch updated patchSplinter Review
Updated patch to fix a compiler error.
Attachment #772854 - Attachment is obsolete: true
Attachment #772854 - Flags: review?(bugs)
Attachment #772879 - Flags: review?
Attachment #772879 - Flags: review? → review?(bugs)
Attachment #772879 - Flags: review?(bugs) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/a14404dc5c68
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: