Attachment #8536252: Part 1 (WIP) - Introduce InputEventContext for bug #920036

View | Details | Raw Unified | Return to bug 920036
Collapse All | Expand All

(-)a/gfx/layers/apz/util/InputEventContext.cpp (+42 lines)
Line     Link Here 
Line 0    Link Here 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#include "InputEventContext.h"
7
8
namespace mozilla {
9
namespace layers {
10
11
ScrollableLayerGuid InputEventContext::sGuid;
12
uint64_t InputEventContext::sBlockId = 0;
13
14
/*static*/ ScrollableLayerGuid
15
InputEventContext::GetTargetLayerGuid()
16
{
17
  return sGuid;
18
}
19
20
/*static*/ uint64_t
21
InputEventContext::GetInputBlockId()
22
{
23
  return sBlockId;
24
}
25
26
InputEventContext::InputEventContext(const ScrollableLayerGuid& aGuid,
27
                                     const uint64_t& aBlockId)
28
  : mOldGuid(sGuid)
29
  , mOldBlockId(sBlockId)
30
{
31
  sGuid = aGuid;
32
  sBlockId = aBlockId;
33
}
34
35
InputEventContext::~InputEventContext()
36
{
37
  sGuid = mOldGuid;
38
  sBlockId = mOldBlockId;
39
}
40
41
}
42
}
(-)a/gfx/layers/apz/util/InputEventContext.h (+42 lines)
Line     Link Here 
Line 0    Link Here 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef mozilla_layers_InputEventContext_h
7
#define mozilla_layers_InputEventContext_h
8
9
#include "FrameMetrics.h"
10
11
namespace mozilla {
12
namespace layers {
13
14
/* This class contains some helper methods that facilitate implementing the
15
   GeckoContentController callback interface required by the AsyncPanZoomController.
16
   Since different platforms need to implement this interface in similar-but-
17
   not-quite-the-same ways, this utility class provides some helpful methods
18
   to hold code that can be shared across the different platform implementations.
19
 */
20
class MOZ_STACK_CLASS InputEventContext
21
{
22
private:
23
  static ScrollableLayerGuid sGuid;
24
  static uint64_t sBlockId;
25
26
public:
27
  static ScrollableLayerGuid GetTargetLayerGuid();
28
  static uint64_t GetInputBlockId();
29
30
  InputEventContext(const ScrollableLayerGuid& aGuid,
31
                    const uint64_t& aBlockId);
32
  ~InputEventContext();
33
34
private:
35
  ScrollableLayerGuid mOldGuid;
36
  uint64_t mOldBlockId;
37
};
38
39
}
40
}
41
42
#endif /* mozilla_layers_InputEventContext_h */
(-)a/gfx/layers/moz.build (+2 lines)
Line     Link Here 
 Lines 109-124   EXPORTS.mozilla.layers += [ Link Here 
109
    'apz/public/GeckoContentController.h',
109
    'apz/public/GeckoContentController.h',
110
    # exporting things from apz/src is temporary until we extract a
110
    # exporting things from apz/src is temporary until we extract a
111
    # proper interface for the code there
111
    # proper interface for the code there
112
    'apz/src/APZCTreeManager.h',
112
    'apz/src/APZCTreeManager.h',
113
    'apz/testutil/APZTestData.h',
113
    'apz/testutil/APZTestData.h',
114
    'apz/util/ActiveElementManager.h',
114
    'apz/util/ActiveElementManager.h',
115
    'apz/util/APZCCallbackHelper.h',
115
    'apz/util/APZCCallbackHelper.h',
116
    'apz/util/ChromeProcessController.h',
116
    'apz/util/ChromeProcessController.h',
117
    'apz/util/InputEventContext.h',
117
    'AtomicRefCountedWithFinalize.h',
118
    'AtomicRefCountedWithFinalize.h',
118
    'AxisPhysicsModel.h',
119
    'AxisPhysicsModel.h',
119
    'AxisPhysicsMSDModel.h',
120
    'AxisPhysicsMSDModel.h',
120
    'basic/BasicCompositor.h',
121
    'basic/BasicCompositor.h',
121
    'basic/MacIOSurfaceTextureHostBasic.h',
122
    'basic/MacIOSurfaceTextureHostBasic.h',
122
    'basic/TextureHostBasic.h',
123
    'basic/TextureHostBasic.h',
123
    'client/CanvasClient.h',
124
    'client/CanvasClient.h',
124
    'client/CompositableClient.h',
125
    'client/CompositableClient.h',
 Lines 241-256   UNIFIED_SOURCES += [ Link Here 
241
    'apz/src/InputBlockState.cpp',
242
    'apz/src/InputBlockState.cpp',
242
    'apz/src/InputQueue.cpp',
243
    'apz/src/InputQueue.cpp',
243
    'apz/src/OverscrollHandoffState.cpp',
244
    'apz/src/OverscrollHandoffState.cpp',
244
    'apz/src/TaskThrottler.cpp',
245
    'apz/src/TaskThrottler.cpp',
245
    'apz/testutil/APZTestData.cpp',
246
    'apz/testutil/APZTestData.cpp',
246
    'apz/util/ActiveElementManager.cpp',
247
    'apz/util/ActiveElementManager.cpp',
247
    'apz/util/APZCCallbackHelper.cpp',
248
    'apz/util/APZCCallbackHelper.cpp',
248
    'apz/util/ChromeProcessController.cpp',
249
    'apz/util/ChromeProcessController.cpp',
250
    'apz/util/InputEventContext.cpp',
249
    'AxisPhysicsModel.cpp',
251
    'AxisPhysicsModel.cpp',
250
    'AxisPhysicsMSDModel.cpp',
252
    'AxisPhysicsMSDModel.cpp',
251
    'basic/BasicCanvasLayer.cpp',
253
    'basic/BasicCanvasLayer.cpp',
252
    'basic/BasicColorLayer.cpp',
254
    'basic/BasicColorLayer.cpp',
253
    'basic/BasicCompositor.cpp',
255
    'basic/BasicCompositor.cpp',
254
    'basic/BasicContainerLayer.cpp',
256
    'basic/BasicContainerLayer.cpp',
255
    'basic/BasicImages.cpp',
257
    'basic/BasicImages.cpp',
256
    'basic/BasicLayerManager.cpp',
258
    'basic/BasicLayerManager.cpp',

Return to bug 920036