Bug 1351783 part 17 - Do less work when apz.keyboard.enabled is false. r=kats

When keyboard apz is disabled, we don't need to calculate focus targets and
we don't need to update focus state. It should be harmless even if it's done,
but I think it's good to not add something on this critical path that doesn't
do anything.

This commit also disable keyboard map generation in this case too for similar
reasoning. This has the side effect that you can't turn on keyboard apz without
doing a restart.

MozReview-Commit-ID: LxmofT2g7qs

--HG--
extra : rebase_source : 719d29efd80498b824fee03a5be1c1fd05c83074
extra : histedit_source : 7ad71a19782fc6dd203207afbdc7a73a936b3e04
This commit is contained in:
Ryan Hunt 2017-06-06 11:08:45 -05:00
Родитель db5f497c0f
Коммит bb5749ccf1
3 изменённых файлов: 14 добавлений и 5 удалений

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

@ -399,6 +399,10 @@ APZCTreeManager::UpdateFocusState(uint64_t aRootLayerTreeId,
uint64_t aOriginatingLayersId,
const FocusTarget& aFocusTarget)
{
if (!gfxPrefs::APZKeyboardEnabled()) {
return;
}
mFocusState.Update(aRootLayerTreeId,
aOriginatingLayersId,
aFocusTarget);

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

@ -6338,10 +6338,12 @@ PresShell::Paint(nsView* aViewToPaint,
return;
}
// Update the focus target for async keyboard scrolling. This will be forwarded
// to APZ by nsDisplayList::PaintRoot. We need to to do this before we enter
// the paint phase because dispatching eVoid events can cause layout to happen.
mAPZFocusTarget = FocusTarget(this, mAPZFocusSequenceNumber);
if (gfxPrefs::APZKeyboardEnabled()) {
// Update the focus target for async keyboard scrolling. This will be forwarded
// to APZ by nsDisplayList::PaintRoot. We need to to do this before we enter
// the paint phase because dispatching eVoid events can cause layout to happen.
mAPZFocusTarget = FocusTarget(this, mAPZFocusSequenceNumber);
}
nsPresContext* presContext = GetPresContext();
AUTO_LAYOUT_PHASE_ENTRY_POINT(presContext, Paint);

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

@ -920,7 +920,10 @@ void nsBaseWidget::ConfigureAPZCTreeManager()
ConfigureAPZControllerThread();
mAPZC->SetDPI(GetDPI());
mAPZC->SetKeyboardMap(nsXBLWindowKeyHandler::CollectKeyboardShortcuts());
if (gfxPrefs::APZKeyboardEnabled()) {
mAPZC->SetKeyboardMap(nsXBLWindowKeyHandler::CollectKeyboardShortcuts());
}
RefPtr<IAPZCTreeManager> treeManager = mAPZC; // for capture by the lambdas