Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/apz/util/ScrollLinkedEffectDetector.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#include "ScrollLinkedEffectDetector.h"
8
9
#include "nsIDocument.h"
10
#include "nsThreadUtils.h"
11
12
namespace mozilla {
13
namespace layers {
14
15
uint32_t ScrollLinkedEffectDetector::sDepth = 0;
16
bool ScrollLinkedEffectDetector::sFoundScrollLinkedEffect = false;
17
18
/* static */ void
19
ScrollLinkedEffectDetector::PositioningPropertyMutated()
20
0
{
21
0
  MOZ_ASSERT(NS_IsMainThread());
22
0
23
0
  if (sDepth > 0) {
24
0
    // We are inside a scroll event dispatch
25
0
    sFoundScrollLinkedEffect = true;
26
0
  }
27
0
}
28
29
ScrollLinkedEffectDetector::ScrollLinkedEffectDetector(nsIDocument* aDoc)
30
  : mDocument(aDoc)
31
0
{
32
0
  MOZ_ASSERT(NS_IsMainThread());
33
0
  sDepth++;
34
0
}
35
36
ScrollLinkedEffectDetector::~ScrollLinkedEffectDetector()
37
0
{
38
0
  sDepth--;
39
0
  if (sDepth == 0) {
40
0
    // We have exited all (possibly-nested) scroll event dispatches,
41
0
    // record whether or not we found an effect, and reset state
42
0
    if (sFoundScrollLinkedEffect) {
43
0
      mDocument->ReportHasScrollLinkedEffect();
44
0
      sFoundScrollLinkedEffect = false;
45
0
    }
46
0
  }
47
0
}
48
49
} // namespace layers
50
} // namespace mozilla