xpcom/string/nsASCIIMask.cpp
author Kartikaya Gupta <kgupta@mozilla.com>
Tue, 23 May 2017 10:50:42 -0400
changeset 408330 fa1a20ec07bfb15ddb9101853ad0cedde28ad7a7
parent 404945 9201d345a1d5cef6b5ffb91ed27983403cc43865
child 439396 e494dc0cad2bf1ea14cfd356632e7296795ef9b5
permissions -rw-r--r--
Bug 1364525 - Update APIs to allow APZ to produce scrollbar transforms. r=pchang,botond This allows the APZCTreeManager::PushStateToWR function to also produce a set of transforms to be applied to scrollbar thumbs. The PushStateToWR function will be updated in the next patch to actually produce the transforms. This patch also rearranges code in WebRenderBridgeParent::CompositeToTarget so that either OMTA or APZ can produce animation updates. MozReview-Commit-ID: 1ghvVG32TC5

/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsASCIIMask.h"

namespace mozilla {

constexpr bool TestWhitespace(char c)
{
  return c == '\f' || c == '\t' || c == '\r' || c == '\n' || c == ' ';
}
constexpr ASCIIMaskArray sWhitespaceMask = CreateASCIIMask(TestWhitespace);

constexpr bool TestCRLF(char c)
{
  return c == '\r' || c == '\n';
}
constexpr ASCIIMaskArray sCRLFMask = CreateASCIIMask(TestCRLF);

constexpr bool TestCRLFTab(char c)
{
  return c == '\r' || c == '\n' || c == '\t';
}
constexpr ASCIIMaskArray sCRLFTabMask = CreateASCIIMask(TestCRLFTab);

constexpr bool TestZeroToNine(char c)
{
  return c == '0' || c == '1' || c == '2' || c == '3' || c == '4' ||
         c == '5' || c == '6' || c == '7' || c == '8' || c == '9';
}
constexpr ASCIIMaskArray sZeroToNineMask = CreateASCIIMask(TestZeroToNine);

const ASCIIMaskArray& ASCIIMask::MaskWhitespace()
{
  return sWhitespaceMask;
}

const ASCIIMaskArray& ASCIIMask::MaskCRLF()
{
  return sCRLFMask;
}

const ASCIIMaskArray& ASCIIMask::MaskCRLFTab()
{
  return sCRLFTabMask;
}

const ASCIIMaskArray& ASCIIMask::Mask0to9()
{
  return sZeroToNineMask;
}

} // namespace mozilla