Bug 1919083 - [ci] Enable os-integration variant for more suites, r=jmaher
[gecko.git] / gfx / layers / ScrollableLayerGuid.cpp
blob42a8a4824f3bc74edc049ef1612299d9fc06f603
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/. */
7 #include "ScrollableLayerGuid.h"
9 #include <ostream>
10 #include "mozilla/HashFunctions.h" // for HashGeneric
11 #include "mozilla/IntegerPrintfMacros.h"
12 #include "nsPrintfCString.h" // for nsPrintfCString
14 namespace mozilla {
15 namespace layers {
17 ScrollableLayerGuid::ScrollableLayerGuid()
18 : mLayersId{0}, mPresShellId(0), mScrollId(0) {}
20 ScrollableLayerGuid::ScrollableLayerGuid(LayersId aLayersId,
21 uint32_t aPresShellId,
22 ViewID aScrollId)
23 : mLayersId(aLayersId), mPresShellId(aPresShellId), mScrollId(aScrollId) {}
25 bool ScrollableLayerGuid::operator==(const ScrollableLayerGuid& other) const {
26 return mLayersId == other.mLayersId && mPresShellId == other.mPresShellId &&
27 mScrollId == other.mScrollId;
30 bool ScrollableLayerGuid::operator!=(const ScrollableLayerGuid& other) const {
31 return !(*this == other);
34 bool ScrollableLayerGuid::operator<(const ScrollableLayerGuid& other) const {
35 if (mLayersId < other.mLayersId) {
36 return true;
38 if (mLayersId == other.mLayersId) {
39 if (mPresShellId < other.mPresShellId) {
40 return true;
42 if (mPresShellId == other.mPresShellId) {
43 return mScrollId < other.mScrollId;
46 return false;
49 std::ostream& operator<<(std::ostream& aOut, const ScrollableLayerGuid& aGuid) {
50 return aOut << nsPrintfCString("{ l=0x%" PRIx64 ", p=%u, v=%" PRIu64 " }",
51 uint64_t(aGuid.mLayersId), aGuid.mPresShellId,
52 aGuid.mScrollId)
53 .get();
56 bool ScrollableLayerGuid::EqualsIgnoringPresShell(
57 const ScrollableLayerGuid& aA, const ScrollableLayerGuid& aB) {
58 return aA.mLayersId == aB.mLayersId && aA.mScrollId == aB.mScrollId;
61 std::size_t ScrollableLayerGuid::HashFn::operator()(
62 const ScrollableLayerGuid& aGuid) const {
63 return HashGeneric(uint64_t(aGuid.mLayersId), aGuid.mPresShellId,
64 aGuid.mScrollId);
67 std::size_t ScrollableLayerGuid::HashIgnoringPresShellFn::operator()(
68 const ScrollableLayerGuid& aGuid) const {
69 return HashGeneric(uint64_t(aGuid.mLayersId), aGuid.mScrollId);
72 bool ScrollableLayerGuid::EqualIgnoringPresShellFn::operator()(
73 const ScrollableLayerGuid& lhs, const ScrollableLayerGuid& rhs) const {
74 return EqualsIgnoringPresShell(lhs, rhs);
77 } // namespace layers
78 } // namespace mozilla