Bug 1178763, move UIEvent.pageX/pageY to MouseEvent, r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D36781

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Olli Pettay 2019-07-04 01:50:22 +00:00
Родитель 3c02a5472d
Коммит d957d5d294
7 изменённых файлов: 33 добавлений и 39 удалений

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

@ -242,6 +242,34 @@ int32_t MouseEvent::ScreenY(CallerType aCallerType) {
return Event::GetScreenCoords(mPresContext, mEvent, mEvent->mRefPoint).y;
}
int32_t MouseEvent::PageX() const {
if (mEvent->mFlags.mIsPositionless) {
return 0;
}
if (mPrivateDataDuplicated) {
return mPagePoint.x;
}
return Event::GetPageCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint)
.x;
}
int32_t MouseEvent::PageY() const {
if (mEvent->mFlags.mIsPositionless) {
return 0;
}
if (mPrivateDataDuplicated) {
return mPagePoint.y;
}
return Event::GetPageCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint)
.y;
}
int32_t MouseEvent::ClientX() {
if (mEvent->mFlags.mIsPositionless) {
return 0;

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

@ -36,6 +36,8 @@ class MouseEvent : public UIEvent {
int32_t ScreenX(CallerType aCallerType);
int32_t ScreenY(CallerType aCallerType);
int32_t PageX() const;
int32_t PageY() const;
int32_t ClientX();
int32_t ClientY();
int32_t OffsetX();

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

@ -134,34 +134,6 @@ void UIEvent::InitUIEvent(const nsAString& typeArg, bool canBubbleArg,
mView = viewArg ? viewArg->GetOuterWindow() : nullptr;
}
int32_t UIEvent::PageX() const {
if (mEvent->mFlags.mIsPositionless) {
return 0;
}
if (mPrivateDataDuplicated) {
return mPagePoint.x;
}
return Event::GetPageCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint)
.x;
}
int32_t UIEvent::PageY() const {
if (mEvent->mFlags.mIsPositionless) {
return 0;
}
if (mPrivateDataDuplicated) {
return mPagePoint.y;
}
return Event::GetPageCoords(mPresContext, mEvent, mEvent->mRefPoint,
mClientPoint)
.y;
}
already_AddRefed<nsINode> UIEvent::GetRangeParent() {
if (NS_WARN_IF(!mPresContext)) {
return nullptr;

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

@ -63,9 +63,6 @@ class UIEvent : public Event {
int32_t LayerY() const { return GetLayerPoint().y; }
int32_t PageX() const;
int32_t PageY() const;
virtual uint32_t Which(CallerType aCallerType = CallerType::System) {
MOZ_ASSERT(mEvent->mClass != eKeyboardEventClass,
"Key events should override Which()");

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

@ -5,6 +5,7 @@
*
* For more information on this interface please see
* http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html
* https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
@ -16,6 +17,8 @@ interface MouseEvent : UIEvent {
readonly attribute long screenX;
[NeedsCallerType]
readonly attribute long screenY;
readonly attribute long pageX;
readonly attribute long pageY;
readonly attribute long clientX;
readonly attribute long clientY;
[BinaryName="clientX"]

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

@ -29,8 +29,6 @@ partial interface UIEvent {
readonly attribute long layerX;
readonly attribute long layerY;
readonly attribute long pageX;
readonly attribute long pageY;
[NeedsCallerType]
readonly attribute unsigned long which;
readonly attribute Node? rangeParent;

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

@ -18,9 +18,3 @@ prefs: [layout.css.getBoxQuads.enabled:true, layout.css.convertFromNode.enabled:
[CSSPseudoElement interface: operation convertPointFromNode(DOMPointInit, GeometryNode, ConvertCoordinateOptions)]
expected: FAIL
[MouseEvent interface: attribute pageX]
expected: FAIL
[MouseEvent interface: attribute pageY]
expected: FAIL