mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 1376912 - Add logging for APZ keyboard scrolling. r=kats
MozReview-Commit-ID: Gp14vangDaS --HG-- extra : rebase_source : 5742f67a5330e1b27382613b5e875087fc9d90d2
This commit is contained in:
parent
c6b138004a
commit
ef12355496
@ -50,6 +50,9 @@
|
||||
# define APZCTM_LOG(...)
|
||||
#endif
|
||||
|
||||
// #define APZ_KEY_LOG(...) printf_stderr("APZKEY: " __VA_ARGS__)
|
||||
#define APZ_KEY_LOG(...)
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
@ -185,7 +188,16 @@ public:
|
||||
{
|
||||
if (mMayChangeFocus) {
|
||||
mFocusState.ReceiveFocusChangingEvent();
|
||||
|
||||
APZ_KEY_LOG("Marking input with type=%d as focus changing with seq=%" PRIu64 "\n",
|
||||
(int)mEvent.mInputType,
|
||||
mFocusState.LastAPZProcessedEvent());
|
||||
} else {
|
||||
APZ_KEY_LOG("Marking input with type=%d as non focus changing with seq=%" PRIu64 "\n",
|
||||
(int)mEvent.mInputType,
|
||||
mFocusState.LastAPZProcessedEvent());
|
||||
}
|
||||
|
||||
mEvent.mFocusSequenceNumber = mFocusState.LastAPZProcessedEvent();
|
||||
}
|
||||
|
||||
@ -1249,6 +1261,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
// Disable async keyboard scrolling when accessibility.browsewithcaret is enabled
|
||||
if (!gfxPrefs::APZKeyboardEnabled() ||
|
||||
gfxPrefs::AccessibilityBrowseWithCaret()) {
|
||||
APZ_KEY_LOG("Skipping key input from invalid prefs\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1258,6 +1271,8 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
Maybe<KeyboardShortcut> shortcut = mKeyboardMap.FindMatch(keyInput);
|
||||
|
||||
if (!shortcut) {
|
||||
APZ_KEY_LOG("Skipping key input with no shortcut\n");
|
||||
|
||||
// If we don't have a shortcut for this key event, then we can keep our focus
|
||||
// only if we know there are no key event listeners for this target
|
||||
if (mFocusState.CanIgnoreKeyboardShortcutMisses()) {
|
||||
@ -1269,6 +1284,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
// Check if this shortcut needs to be dispatched to content. Anything matching
|
||||
// this is assumed to be able to change focus.
|
||||
if (shortcut->mDispatchToContent) {
|
||||
APZ_KEY_LOG("Skipping key input with dispatch-to-content shortcut\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1299,6 +1315,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
// the focused element has event listeners, or the focused element doesn't have a
|
||||
// layerized scroll frame. In any case we need to dispatch to content.
|
||||
if (!targetGuid) {
|
||||
APZ_KEY_LOG("Skipping key input with no current focus target\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1306,6 +1323,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
targetGuid->mScrollId);
|
||||
|
||||
if (!targetApzc) {
|
||||
APZ_KEY_LOG("Skipping key input with focus target but no APZC\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1313,6 +1331,9 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
// by the input queue.
|
||||
keyInput.mAction = action;
|
||||
|
||||
APZ_KEY_LOG("Dispatching key input with apzc=%p\n",
|
||||
targetApzc.get());
|
||||
|
||||
// Dispatch the event to the input queue.
|
||||
result = mInputQueue->ReceiveInputEvent(
|
||||
targetApzc,
|
||||
|
@ -5,6 +5,9 @@
|
||||
|
||||
#include "mozilla/layers/FocusState.h"
|
||||
|
||||
// #define FS_LOG(...) printf_stderr("FS: " __VA_ARGS__)
|
||||
#define FS_LOG(...)
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
@ -21,6 +24,10 @@ FocusState::FocusState()
|
||||
bool
|
||||
FocusState::IsCurrent() const
|
||||
{
|
||||
FS_LOG("Checking IsCurrent() with cseq=%" PRIu64 ", aseq=%" PRIu64 "\n",
|
||||
mLastContentProcessedEvent,
|
||||
mLastAPZProcessedEvent);
|
||||
|
||||
MOZ_ASSERT(mLastContentProcessedEvent <= mLastAPZProcessedEvent);
|
||||
return mLastContentProcessedEvent == mLastAPZProcessedEvent;
|
||||
}
|
||||
@ -36,6 +43,12 @@ FocusState::Update(uint64_t aRootLayerTreeId,
|
||||
uint64_t aOriginatingLayersId,
|
||||
const FocusTarget& aState)
|
||||
{
|
||||
FS_LOG("Update with rlt=%" PRIu64 ", olt=%" PRIu64 ", ft=(%d, %" PRIu64 ")\n",
|
||||
aRootLayerTreeId,
|
||||
aOriginatingLayersId,
|
||||
(int)aState.mType,
|
||||
aState.mSequenceNumber);
|
||||
|
||||
// Update the focus tree with the latest target
|
||||
mFocusTree[aOriginatingLayersId] = aState;
|
||||
|
||||
@ -51,6 +64,8 @@ FocusState::Update(uint64_t aRootLayerTreeId,
|
||||
while (true) {
|
||||
auto currentNode = mFocusTree.find(mFocusLayersId);
|
||||
if (currentNode == mFocusTree.end()) {
|
||||
FS_LOG("Setting target to nil (cannot find lt=%" PRIu64 ")\n",
|
||||
mFocusLayersId);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -64,14 +79,23 @@ FocusState::Update(uint64_t aRootLayerTreeId,
|
||||
// Guard against infinite loops
|
||||
MOZ_ASSERT(mFocusLayersId != target.mData.mRefLayerId);
|
||||
if (mFocusLayersId == target.mData.mRefLayerId) {
|
||||
FS_LOG("Setting target to nil (bailing out of infinite loop, lt=%" PRIu64 ")\n",
|
||||
mFocusLayersId);
|
||||
return;
|
||||
}
|
||||
|
||||
FS_LOG("Looking for target in lt=%" PRIu64 "\n", target.mData.mRefLayerId);
|
||||
|
||||
// The focus target is in a child layer tree
|
||||
mFocusLayersId = target.mData.mRefLayerId;
|
||||
break;
|
||||
}
|
||||
case FocusTarget::eScrollLayer: {
|
||||
FS_LOG("Setting target to h=%" PRIu64 ", v=%" PRIu64 ", and seq=%" PRIu64 "\n",
|
||||
target.mData.mScrollTargets.mHorizontal,
|
||||
target.mData.mScrollTargets.mVertical,
|
||||
target.mSequenceNumber);
|
||||
|
||||
// This is the global focus target
|
||||
mFocusHorizontalTarget = target.mData.mScrollTargets.mHorizontal;
|
||||
mFocusVerticalTarget = target.mData.mScrollTargets.mVertical;
|
||||
@ -82,6 +106,8 @@ FocusState::Update(uint64_t aRootLayerTreeId,
|
||||
return;
|
||||
}
|
||||
case FocusTarget::eNone: {
|
||||
FS_LOG("Setting target to nil (reached a nil target)\n");
|
||||
|
||||
// Mark what sequence number this target has for debugging purposes so
|
||||
// we can always accurately report on whether we are stale or not
|
||||
mLastContentProcessedEvent = target.mSequenceNumber;
|
||||
|
@ -12,6 +12,17 @@
|
||||
#include "nsIPresShell.h" // for nsIPresShell
|
||||
#include "nsLayoutUtils.h" // for nsLayoutUtils
|
||||
|
||||
#define ENABLE_FT_LOGGING 0
|
||||
// #define ENABLE_FT_LOGGING 1
|
||||
|
||||
#if ENABLE_FT_LOGGING
|
||||
# define FT_LOG(FMT, ...) printf_stderr("FT (%s): " FMT, \
|
||||
XRE_IsParentProcess() ? "chrome" : "content", \
|
||||
__VA_ARGS__)
|
||||
#else
|
||||
# define FT_LOG(...)
|
||||
#endif
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layout;
|
||||
|
||||
@ -85,6 +96,9 @@ FocusTarget::FocusTarget(nsIPresShell* aRootPresShell,
|
||||
nsCOMPtr<nsIPresShell> presShell = GetRetargetEventPresShell(aRootPresShell);
|
||||
|
||||
if (!presShell) {
|
||||
FT_LOG("Creating nil target with seq=%" PRIu64 " (can't find retargeted presshell)\n",
|
||||
aFocusSequenceNumber);
|
||||
|
||||
mType = FocusTarget::eNone;
|
||||
return;
|
||||
}
|
||||
@ -103,11 +117,18 @@ FocusTarget::FocusTarget(nsIPresShell* aRootPresShell,
|
||||
|
||||
// The globally focused element for scrolling is in a remote layer tree
|
||||
if (rfp) {
|
||||
FT_LOG("Creating reflayer target with seq=%" PRIu64 ", lt=%" PRIu64 "\n",
|
||||
aFocusSequenceNumber,
|
||||
rfp->GetLayersId());
|
||||
|
||||
mType = FocusTarget::eRefLayer;
|
||||
mData.mRefLayerId = rfp->GetLayersId();
|
||||
return;
|
||||
}
|
||||
|
||||
FT_LOG("Creating nil target with seq=%" PRIu64 " (remote browser missing layers id)\n",
|
||||
aFocusSequenceNumber);
|
||||
|
||||
mType = FocusTarget::eNone;
|
||||
return;
|
||||
}
|
||||
@ -115,6 +136,9 @@ FocusTarget::FocusTarget(nsIPresShell* aRootPresShell,
|
||||
// If the focus isn't on a remote browser then check for scrollable targets
|
||||
if (IsEditableNode(scrollTarget) ||
|
||||
IsEditableNode(presShell->GetDocument())) {
|
||||
FT_LOG("Creating nil target with seq=%" PRIu64 " (disabling for editable node)\n",
|
||||
aFocusSequenceNumber);
|
||||
|
||||
mType = FocusTarget::eNone;
|
||||
return;
|
||||
}
|
||||
@ -135,6 +159,11 @@ FocusTarget::FocusTarget(nsIPresShell* aRootPresShell,
|
||||
nsLayoutUtils::FindIDForScrollableFrame(horizontal);
|
||||
mData.mScrollTargets.mVertical =
|
||||
nsLayoutUtils::FindIDForScrollableFrame(vertical);
|
||||
|
||||
FT_LOG("Creating scroll target with seq=%" PRIu64 ", h=%" PRIu64 ", v=%" PRIu64 "\n",
|
||||
aFocusSequenceNumber,
|
||||
mData.mScrollTargets.mHorizontal,
|
||||
mData.mScrollTargets.mVertical);
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user