Bug 1193062 - Don't double-send target APZC confirmations that might race each other. r=kats

When scrolling an inactive subframe, the target APZC confirmation needs to be sent along with the layers transaction. If a new wheel event comes in while that target APZC notification is in-flight, the subframe will already have a display port, so the confirmation will be sent in a more direct fashion and can arrive at the APZ controller thread before the new APZC for the scroll frame has been created. Then the current input block will have a null target APZC and no scrolling will happen until a new input block is created. (For wheel transactions, a null target APZC ends the transaction, so the next event will create a new input block.)

--HG--
extra : commitid : Ij9XfKKZAqe
extra : rebase_source : 66196ed4e3e98159f7b17f7e8d90c5f2985425e6
extra : histedit_source : c028ec2f7817bb8d9396849495bfeaa17cbe7064
This commit is contained in:
Markus Stange 2015-08-11 16:51:46 -04:00
Родитель 316505e2bd
Коммит 8c83121309
2 изменённых файлов: 16 добавлений и 0 удалений

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

@ -10,6 +10,7 @@
#include "gfxPrefs.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/layers/LayerTransactionChild.h"
#include "mozilla/layers/ShadowLayers.h"
#include "mozilla/TouchEvents.h"
@ -32,6 +33,8 @@ namespace layers {
using dom::TabParent;
uint64_t APZCCallbackHelper::sLastTargetAPZCNotificationInputBlock = uint64_t(-1);
static void
AdjustDisplayPortForScrollDelta(mozilla::layers::FrameMetrics& aFrameMetrics,
const CSSPoint& aActualScrollOffset)
@ -741,6 +744,16 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
if (!aWidget || !aDocument) {
return;
}
if (aInputBlockId == sLastTargetAPZCNotificationInputBlock) {
// We have already confirmed the target APZC for a previous event of this
// input block. If we activated a scroll frame for this input block,
// sending another target APZC confirmation would be harmful, as it might
// race the original confirmation (which needs to go through a layers
// transaction).
APZCCH_LOG("Not resending target APZC confirmation for input block %" PRIu64 "\n", aInputBlockId);
return;
}
sLastTargetAPZCNotificationInputBlock = aInputBlockId;
if (nsIPresShell* shell = aDocument->GetShell()) {
if (nsIFrame* rootFrame = shell->GetRootFrame()) {
bool waitForRefresh = false;

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

@ -173,6 +173,9 @@ public:
/* Temporarily ignore the Displayport for better paint performance. */
static void SuppressDisplayport(const bool& aEnabled);
static bool IsDisplayportSuppressed();
private:
static uint64_t sLastTargetAPZCNotificationInputBlock;
};
} // namespace layers