зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1357880 - Add a telemetry probe for mousemove event listeners r=smaug, data-review=bsmedberg
This commit adds a telemetry probe to determine the percentage of pages that ever have a 'mousemove' event listener added to the DOM. This is for determining how often APZ key scrolling could handle interleaved mousemove events. A flag is added to nsPIDOMWindow to track whether a qualifying event listener was ever added to the DOM for this window, and is updated by EventListenerManager. There are several other similar flags to this. The probe is reported in nsGlobalWindow::FreeInnerObjects() so that it can be compared exactly with the non-passive keyboard listener APZ probe. MozReview-Commit-ID: DqqCfrdRCGp --HG-- extra : rebase_source : fad8159c28b587572a4191f7cbde1e97e166639c
This commit is contained in:
Родитель
ebd2c4d010
Коммит
d5bf64b9d4
|
@ -978,6 +978,7 @@ nsPIDOMWindow<T>::nsPIDOMWindow(nsPIDOMWindowOuter *aOuterWindow)
|
|||
mIsHandlingResizeEvent(false), mIsInnerWindow(aOuterWindow != nullptr),
|
||||
mMayHavePaintEventListener(false), mMayHaveTouchEventListener(false),
|
||||
mMayHaveMouseEnterLeaveEventListener(false),
|
||||
mMayHaveMouseMoveEventListener(false),
|
||||
mMayHavePointerEnterLeaveEventListener(false),
|
||||
mInnerObjectsFreed(false),
|
||||
mIsModalContentWindow(false),
|
||||
|
@ -2050,11 +2051,14 @@ nsGlobalWindow::FreeInnerObjects()
|
|||
EventTarget* html = mDoc->GetHtmlElement();
|
||||
EventTarget* body = mDoc->GetBodyElement();
|
||||
|
||||
bool mouseAware = AsInner()->HasMouseMoveEventListeners();
|
||||
bool keyboardAware = win->MayHaveAPZAwareKeyEventListener() ||
|
||||
mDoc->MayHaveAPZAwareKeyEventListener() ||
|
||||
(html && html->MayHaveAPZAwareKeyEventListener()) ||
|
||||
(body && body->MayHaveAPZAwareKeyEventListener());
|
||||
|
||||
Telemetry::Accumulate(Telemetry::APZ_AWARE_MOUSEMOVE_LISTENERS,
|
||||
mouseAware ? 1 : 0);
|
||||
Telemetry::Accumulate(Telemetry::APZ_AWARE_KEY_LISTENERS,
|
||||
keyboardAware ? 1 : 0);
|
||||
}
|
||||
|
|
|
@ -539,6 +539,9 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
|||
if (elm->MayHaveTouchEventListener()) {
|
||||
window->SetHasTouchEventListeners();
|
||||
}
|
||||
if (elm->MayHaveMouseMoveEventListener()) {
|
||||
window->SetHasMouseMoveEventListeners();
|
||||
}
|
||||
if (elm->MayHaveMouseEnterLeaveEventListener()) {
|
||||
window->SetHasMouseEnterLeaveEventListeners();
|
||||
}
|
||||
|
|
|
@ -669,6 +669,7 @@ protected:
|
|||
bool mMayHavePaintEventListener;
|
||||
bool mMayHaveTouchEventListener;
|
||||
bool mMayHaveMouseEnterLeaveEventListener;
|
||||
bool mMayHaveMouseMoveEventListener;
|
||||
bool mMayHavePointerEnterLeaveEventListener;
|
||||
|
||||
// Used to detect whether we have called FreeInnerObjects() (e.g. to ensure
|
||||
|
@ -814,6 +815,24 @@ public:
|
|||
mMutationBits |= aType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to check whether some node (this window, its document,
|
||||
* or content in that document) has or had a mousemove event listener.
|
||||
*/
|
||||
bool HasMouseMoveEventListeners()
|
||||
{
|
||||
return mMayHaveMouseMoveEventListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to indicate that some node (this window, its document,
|
||||
* or content in that document) has or had a mousemove event listener.
|
||||
*/
|
||||
void SetHasMouseMoveEventListeners()
|
||||
{
|
||||
mMayHaveMouseMoveEventListener = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to check whether some node (this window, its document,
|
||||
* or content in that document) has a mouseenter/leave event listener.
|
||||
|
|
|
@ -127,6 +127,7 @@ EventListenerManagerBase::EventListenerManagerBase()
|
|||
, mMayHaveCapturingListeners(false)
|
||||
, mMayHaveSystemGroupListeners(false)
|
||||
, mMayHaveTouchEventListener(false)
|
||||
, mMayHaveMouseMoveEventListener(false)
|
||||
, mMayHaveMouseEnterLeaveEventListener(false)
|
||||
, mMayHavePointerEnterLeaveEventListener(false)
|
||||
, mMayHaveAPZAwareKeyEventListener(false)
|
||||
|
@ -422,6 +423,11 @@ EventListenerManager::AddEventListenerInternal(
|
|||
if (!aFlags.mInSystemGroup) {
|
||||
mMayHaveInputOrCompositionEventListener = true;
|
||||
}
|
||||
} else if (aTypeAtom == nsGkAtoms::onmousemove) {
|
||||
mMayHaveMouseMoveEventListener = true;
|
||||
if (nsPIDOMWindowInner* window = GetInnerWindowForTarget()) {
|
||||
window->SetHasMouseMoveEventListeners();
|
||||
}
|
||||
}
|
||||
|
||||
if (IsApzAwareListener(listener)) {
|
||||
|
|
|
@ -161,6 +161,7 @@ protected:
|
|||
uint16_t mMayHaveCapturingListeners : 1;
|
||||
uint16_t mMayHaveSystemGroupListeners : 1;
|
||||
uint16_t mMayHaveTouchEventListener : 1;
|
||||
uint16_t mMayHaveMouseMoveEventListener : 1;
|
||||
uint16_t mMayHaveMouseEnterLeaveEventListener : 1;
|
||||
uint16_t mMayHavePointerEnterLeaveEventListener : 1;
|
||||
uint16_t mMayHaveAPZAwareKeyEventListener : 1;
|
||||
|
@ -168,7 +169,7 @@ protected:
|
|||
uint16_t mMayHaveInputOrCompositionEventListener : 1;
|
||||
uint16_t mClearingListeners : 1;
|
||||
uint16_t mIsMainThreadELM : 1;
|
||||
// uint16_t mUnused : 4;
|
||||
// uint16_t mUnused : 3;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -440,6 +441,8 @@ public:
|
|||
*/
|
||||
bool MayHaveTouchEventListener() { return mMayHaveTouchEventListener; }
|
||||
|
||||
bool MayHaveMouseMoveEventListener() { return mMayHaveMouseMoveEventListener; }
|
||||
|
||||
bool MayHaveMouseEnterLeaveEventListener() { return mMayHaveMouseEnterLeaveEventListener; }
|
||||
bool MayHavePointerEnterLeaveEventListener() { return mMayHavePointerEnterLeaveEventListener; }
|
||||
|
||||
|
|
|
@ -10442,6 +10442,13 @@
|
|||
"kind": "boolean",
|
||||
"description": "The percentage of pages with a non-passive key event on the path to the root scrolling element that would disable APZ key scrolling. This is tracked for non system principal windows, so it applies to toplevel windows and subframes/iframes, but not chrome windows. "
|
||||
},
|
||||
"APZ_AWARE_MOUSEMOVE_LISTENERS": {
|
||||
"alert_emails": ["rhunt@mozilla.com"],
|
||||
"bug_numbers": [1352654],
|
||||
"expires_in_version": "58",
|
||||
"kind": "boolean",
|
||||
"description": "The percentage of pages with a mousemove listener anywhere in the document that would disable APZ key scrolling. This is tracked for non system principal windows, so it applies to toplevel windows and subframes/iframes, but not chrome windows."
|
||||
},
|
||||
"SCROLL_INPUT_METHODS": {
|
||||
"alert_emails": ["botond@mozilla.com"],
|
||||
"bug_numbers": [1238137],
|
||||
|
|
Загрузка…
Ссылка в новой задаче