Closed
Bug 1125040
Opened 10 years ago
Closed 10 years ago
Use LayoutDeviceIntPoint in more places
Categories
(Core :: DOM: Events, defect)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
mozilla38
Tracking | Status | |
---|---|---|
firefox38 | --- | fixed |
People
(Reporter: dzbarsky, Assigned: dzbarsky)
References
Details
Attachments
(11 files, 3 obsolete files)
37.10 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
7.61 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
64.04 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
4.66 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
2.13 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
2.00 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
29.35 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
3.92 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
27.04 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
3.37 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
10.59 KB,
patch
|
botond
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•10 years ago
|
||
Comment on attachment 8553586 [details] [diff] [review] Patch I guessed on the reviewer here, feel free to bounce to someone else. Try run at https://treeherder.mozilla.org/#/jobs?repo=try&revision=5fcc784b526c
Attachment #8553586 -
Attachment is patch: true
Attachment #8553586 -
Attachment mime type: message/rfc822 → text/plain
Attachment #8553586 -
Flags: review?(botond)
Assignee | ||
Updated•10 years ago
|
Attachment #8553586 -
Flags: review?(botond)
Assignee | ||
Comment 2•10 years ago
|
||
Cleaned up the previous patch.
Assignee: nobody → dzbarsky
Attachment #8553586 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8553998 -
Flags: review?(botond)
Updated•10 years ago
|
Summary: Use LayoutDeviceIntPoint for nsLayoutUtils::GetEventCoordinatesRelativeTo and Point::mRefPoint → Use LayoutDeviceIntPoint for nsLayoutUtils::GetEventCoordinatesRelativeTo and Touch::mRefPoint
Assignee | ||
Comment 3•10 years ago
|
||
Rebased to master and passing try: https://tbpl.mozilla.org/?tree=Try&rev=d1667e6790ac
Attachment #8553998 -
Attachment is obsolete: true
Attachment #8553998 -
Flags: review?(botond)
Attachment #8554192 -
Flags: review?(botond)
Assignee | ||
Updated•10 years ago
|
Summary: Use LayoutDeviceIntPoint for nsLayoutUtils::GetEventCoordinatesRelativeTo and Touch::mRefPoint → Use LayoutDeviceIntPoint in more places
Assignee | ||
Updated•10 years ago
|
Attachment #8554192 -
Attachment description: Patch → for nsLayoutUtils::GetEventCoordinatesRelativeTo and Touch::mRefPoint
Assignee | ||
Comment 4•10 years ago
|
||
Attachment #8554310 -
Flags: review?(botond)
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8554311 -
Flags: review?(botond)
Comment 6•10 years ago
|
||
Comment on attachment 8554192 [details] [diff] [review] for nsLayoutUtils::GetEventCoordinatesRelativeTo and Touch::mRefPoint Review of attachment 8554192 [details] [diff] [review]: ----------------------------------------------------------------- LGTM, and thanks for spreading strongly-typed coordinates! ::: layout/base/nsLayoutUtils.h @@ -674,5 @@ > * @param aPoint the point to get the coordinates relative to > * @param aFrame the frame to make coordinates relative to > * @return the point, or (NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE) if > * for some reason the coordinates for the mouse are not known (e.g., > - * the event is not a GUI event). Stray line removal, please add back. @@ +678,4 @@ > */ > static nsPoint GetEventCoordinatesRelativeTo( > const mozilla::WidgetEvent* aEvent, > + const mozilla::LayoutDeviceIntPoint aPoint, Let's take |aPoint| by const-reference (for consistency with other functions that take points as arguments), since we're changing the signature anyways. @@ +691,5 @@ > * for some reason the coordinates for the mouse are not known (e.g., > * the event is not a GUI event). > */ > static nsPoint GetEventCoordinatesRelativeTo(nsIWidget* aWidget, > + const mozilla::LayoutDeviceIntPoint aPoint, Likewise here (take by const-reference). @@ +715,5 @@ > * @return the point in the view's coordinates > */ > static nsPoint TranslateWidgetToView(nsPresContext* aPresContext, > + nsIWidget* aWidget, > + mozilla::LayoutDeviceIntPoint aPt, And here. ::: widget/android/nsWindow.cpp @@ +1144,1 @@ > ae->Points()[0].y); nit: adjust spacing so this continues lining up
Attachment #8554192 -
Flags: review?(botond) → review+
Comment 7•10 years ago
|
||
Comment on attachment 8554310 [details] [diff] [review] GetEventPoint Review of attachment 8554310 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/xul/nsResizerFrame.h @@ +66,5 @@ > static void RestoreOriginalSize(nsIContent* aContent); > > protected: > nsIntRect mMouseDownRect; > + LayoutDeviceIntPoint mMouseDownPoint; Indentation (or is it just bugzilla messing it up?)
Attachment #8554310 -
Flags: review?(botond) → review+
Comment 8•10 years ago
|
||
Comment on attachment 8554311 [details] [diff] [review] WidgetToScreen Review of attachment 8554311 [details] [diff] [review]: ----------------------------------------------------------------- ::: widget/nsIWidget.h @@ +1637,5 @@ > * @return screen coordinates stored in the x,y members > */ > > + virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() = 0; > + virtual nsIntPoint WidgetToScreenOffsetUntyped() { Please add a comment saying that this function is to help transition from untyped to typed coordinates, and will be removed once the transition is complete.
Attachment #8554311 -
Flags: review?(botond) → review+
Assignee | ||
Comment 9•10 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #7) > Comment on attachment 8554310 [details] [diff] [review] > GetEventPoint > > Review of attachment 8554310 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: layout/xul/nsResizerFrame.h > @@ +66,5 @@ > > static void RestoreOriginalSize(nsIContent* aContent); > > > > protected: > > nsIntRect mMouseDownRect; > > + LayoutDeviceIntPoint mMouseDownPoint; > > Indentation (or is it just bugzilla messing it up?) There was a tab on the nsIntRect line. Thanks for the reviews! I'll send some more patches your way :) remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/c36a026244de remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/9dbdaf7ab14d remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/5167196c4b98
Whiteboard: [leave open]
Assignee | ||
Comment 10•10 years ago
|
||
Attachment #8557657 -
Flags: review?(botond)
Assignee | ||
Comment 11•10 years ago
|
||
Attachment #8557658 -
Flags: review?(botond)
Assignee | ||
Comment 12•10 years ago
|
||
Attachment #8557659 -
Flags: review?(botond)
Assignee | ||
Comment 13•10 years ago
|
||
Attachment #8557660 -
Flags: review?(botond)
Comment 14•10 years ago
|
||
Backed out the WidgetToScreen hunk in https://hg.mozilla.org/integration/mozilla-inbound/rev/5af5c02018a2 for not compiling on Linux, https://treeherder.mozilla.org/logviewer.html#?job_id=6147608&repo=mozilla-inbound
Comment 15•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/c36a026244de https://hg.mozilla.org/mozilla-central/rev/9dbdaf7ab14d
Updated•10 years ago
|
Attachment #8557657 -
Flags: review?(botond) → review+
Updated•10 years ago
|
Attachment #8557658 -
Flags: review?(botond) → review+
Updated•10 years ago
|
Attachment #8557659 -
Flags: review?(botond) → review+
Updated•10 years ago
|
Attachment #8557660 -
Flags: review?(botond) → review+
Assignee | ||
Comment 16•10 years ago
|
||
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/52de461bce37 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/b4c9c91426b3 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/b3e853e7c487 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/345796581183 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/de5837c6e80b
Comment 17•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/52de461bce37 https://hg.mozilla.org/mozilla-central/rev/b4c9c91426b3 https://hg.mozilla.org/mozilla-central/rev/b3e853e7c487 https://hg.mozilla.org/mozilla-central/rev/345796581183 https://hg.mozilla.org/mozilla-central/rev/de5837c6e80b
Assignee | ||
Comment 18•10 years ago
|
||
This is the last set of patches I have
Attachment #8563040 -
Flags: review?(botond)
Assignee | ||
Comment 19•10 years ago
|
||
Attachment #8563042 -
Flags: review?(botond)
Assignee | ||
Comment 20•10 years ago
|
||
Attachment #8563043 -
Flags: review?(botond)
Assignee | ||
Comment 21•10 years ago
|
||
Attachment #8563044 -
Flags: review?(botond)
Assignee | ||
Comment 22•10 years ago
|
||
Attachment #8563043 -
Attachment is obsolete: true
Attachment #8563043 -
Flags: review?(botond)
Attachment #8563084 -
Flags: review?(botond)
Updated•10 years ago
|
Attachment #8563040 -
Flags: review?(botond) → review+
Updated•10 years ago
|
Attachment #8563044 -
Flags: review?(botond) → review+
Updated•10 years ago
|
Attachment #8563084 -
Flags: review?(botond) → review+
Updated•10 years ago
|
Attachment #8563042 -
Flags: review?(botond) → review+
Assignee | ||
Comment 23•10 years ago
|
||
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/f6f451fd1326 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/157e840119de remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/b736b6fb4d1b remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/e0060a3e4ed8
Whiteboard: [leave open]
Comment 24•10 years ago
|
||
Comment on attachment 8563084 [details] [diff] [review] GetScreenCoords Review of attachment 8563084 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/events/Event.cpp @@ +905,5 @@ > LayoutDeviceIntPoint offset = aPoint + guiEvent->widget->WidgetToScreenOffset(); > nscoord factor = > aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom(); > + return LayoutDeviceIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor), > + nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor)); This looks suspicious to me... ::: dom/events/UIEvent.cpp @@ +362,4 @@ > Event::GetScreenCoords(mPresContext, mEvent, mEvent->refPoint); > nsresult rv = Event::DuplicatePrivateData(); > if (NS_SUCCEEDED(rv)) { > + mEvent->refPoint = screenPoint; ISTR that refPoint could be in several coordinate systems.
Assignee | ||
Comment 25•10 years ago
|
||
Comment on attachment 8563084 [details] [diff] [review] GetScreenCoords Review of attachment 8563084 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/events/UIEvent.cpp @@ +362,4 @@ > Event::GetScreenCoords(mPresContext, mEvent, mEvent->refPoint); > nsresult rv = Event::DuplicatePrivateData(); > if (NS_SUCCEEDED(rv)) { > + mEvent->refPoint = screenPoint; From what I've seen, refPoint can sometimes be in Screen coordinates in addition to LayoutDevice coordinates. This is pretty much the only place where it seems like it may be in CSS coordinates. Also, the comment claims GetScreenPoint converts refPoint to the right coordinates, but the only GetScreenPoint I saw is in dom/events/WheelHandlingHelper.cpp, which just adds the child process offset. So I'm not sure how this is supposed to work, but I'd rather avoid mucking aroundf too much and breaking everything
Comment 26•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f6f451fd1326 https://hg.mozilla.org/mozilla-central/rev/157e840119de https://hg.mozilla.org/mozilla-central/rev/b736b6fb4d1b https://hg.mozilla.org/mozilla-central/rev/e0060a3e4ed8
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox38:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Comment 27•9 years ago
|
||
(In reply to :Ms2ger from comment #24) > Comment on attachment 8563084 [details] [diff] [review] > GetScreenCoords > > Review of attachment 8563084 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/events/Event.cpp > @@ +905,5 @@ > > LayoutDeviceIntPoint offset = aPoint + guiEvent->widget->WidgetToScreenOffset(); > > nscoord factor = > > aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom(); > > + return LayoutDeviceIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor), > > + nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor)); > > This looks suspicious to me... Indeed, this is wrong. The type of Touch::mScreenPoint should be CSSIntPoint, not LayoutDeviceIntPoint. Apologies for missing this comment originally!
Comment 28•9 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #27) > Indeed, this is wrong. The type of Touch::mScreenPoint should be > CSSIntPoint, not LayoutDeviceIntPoint. Apologies for missing this comment > originally! Randall is touching this code in bug 1122804 (it was a discussion about that bug that that prompted me to look at this code in more detail), this will be fixed up there.
Blocks: 1122804
You need to log in
before you can comment on or make changes to this bug.
Description
•