Bug 1376538 - Transmit APZ focus target updates on empty transactions. r=kats

This commit also schedules empty transactions on input events that trigger a
focus sequence number update.

MozReview-Commit-ID: 1FWXfStLsGv

--HG--
extra : rebase_source : 02c6f07287b6909493f6f88345a3cca93ab3e45b
This commit is contained in:
Ryan Hunt 2017-06-28 15:11:04 -04:00
Родитель 26f0647adc
Коммит f2d4d39378
4 изменённых файлов: 13 добавлений и 15 удалений

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

@ -802,7 +802,6 @@ nsIPresShell::nsIPresShell()
, mObservingLayoutFlushes(false)
, mNeedThrottledAnimationFlush(true)
, mPresShellId(0)
, mAPZFocusSequenceNumber(0)
, mFontSizeInflationEmPerLine(0)
, mFontSizeInflationMinTwips(0)
, mFontSizeInflationLineThreshold(0)
@ -831,6 +830,7 @@ PresShell::PresShell()
, mLastCallbackEventRequest(nullptr)
, mLastReflowStart(0.0)
, mLastAnchorScrollPositionY(0)
, mAPZFocusSequenceNumber(0)
, mChangeNestCount(0)
, mDocumentLoading(false)
, mIgnoreFrameDestruction(false)
@ -6370,6 +6370,10 @@ PresShell::Paint(nsView* aViewToPaint,
return;
}
// Send an updated focus target with this transaction. Be sure to do this
// before we paint in the case this is an empty transaction.
layerManager->SetFocusTarget(mAPZFocusTarget);
if (frame) {
// Try to do an empty transaction, if the frame tree does not
// need to be updated. Do not try to do an empty transaction on
@ -7159,8 +7163,10 @@ PresShell::HandleEvent(nsIFrame* aFrame,
// Update the latest focus sequence number with this new sequence number
if (mAPZFocusSequenceNumber < aEvent->mFocusSequenceNumber) {
// XXX should we push a new FocusTarget to APZ here
mAPZFocusSequenceNumber = aEvent->mFocusSequenceNumber;
// Schedule an empty transaction to transmit this focus update
aFrame->SchedulePaint(nsIFrame::PAINT_COMPOSITE_ONLY);
}
if (sPointerEventEnabled) {

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

@ -862,6 +862,11 @@ protected:
// when target of pointer event was deleted during executing user handlers.
nsCOMPtr<nsIContent> mPointerEventTarget;
// The focus sequence number of the last processed input event
uint64_t mAPZFocusSequenceNumber;
// The focus information needed for async keyboard scrolling
FocusTarget mAPZFocusTarget;
// This is used to protect ourselves from triggering reflow while in the
// middle of frame construction and the like... it really shouldn't be
// needed, one hopes, but it is for now.

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

@ -1528,11 +1528,6 @@ public:
uint32_t GetPresShellId() { return mPresShellId; }
/**
* Get the APZ FocusTarget used for async keyboard scrolling.
*/
const FocusTarget& GetAPZFocusTarget() const { return mAPZFocusTarget; }
/**
* Dispatch a mouse move event based on the most recent mouse position if
* this PresShell is visible. This is used when the contents of the page
@ -1905,11 +1900,6 @@ protected:
uint32_t mPresShellId;
// The focus sequence number of the last processed input event
uint64_t mAPZFocusSequenceNumber;
// The focus information needed for async keyboard scrolling
FocusTarget mAPZFocusTarget;
static nsIContent* gKeyDownTarget;
// Cached font inflation values. This is done to prevent changing of font

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

@ -2226,9 +2226,6 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
isRootContent, containerParameters));
}
// Send an updated focus target with this transaction
layerManager->SetFocusTarget(presShell->GetAPZFocusTarget());
// NS_WARNING is debug-only, so don't even bother checking the conditions in
// a release build.
#ifdef DEBUG