tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

LayerAnimationInfo.cpp (1576B)


      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 "LayerAnimationInfo.h"
      8 
      9 #include "nsCSSPropertyIDSet.h"  // For nsCSSPropertyIDSet::CompositorAnimatable
     10 #include "nsCSSProps.h"          // For nsCSSProps::PropHasFlags
     11 
     12 namespace mozilla {
     13 
     14 /* static */ const Array<
     15    DisplayItemType, nsCSSPropertyIDSet::CompositorAnimatableDisplayItemCount()>
     16    LayerAnimationInfo::sDisplayItemTypes = {
     17        DisplayItemType::TYPE_BACKGROUND_COLOR,
     18        DisplayItemType::TYPE_OPACITY,
     19        DisplayItemType::TYPE_TRANSFORM,
     20 };
     21 
     22 /* static */
     23 DisplayItemType LayerAnimationInfo::GetDisplayItemTypeForProperty(
     24    NonCustomCSSPropertyId aProperty) {
     25  switch (aProperty) {
     26    case eCSSProperty_background_color:
     27      return DisplayItemType::TYPE_BACKGROUND_COLOR;
     28    case eCSSProperty_opacity:
     29      return DisplayItemType::TYPE_OPACITY;
     30    case eCSSProperty_transform:
     31    case eCSSProperty_translate:
     32    case eCSSProperty_scale:
     33    case eCSSProperty_rotate:
     34    case eCSSProperty_offset_path:
     35    case eCSSProperty_offset_distance:
     36    case eCSSProperty_offset_rotate:
     37    case eCSSProperty_offset_anchor:
     38    case eCSSProperty_offset_position:
     39      return DisplayItemType::TYPE_TRANSFORM;
     40    default:
     41      break;
     42  }
     43  return DisplayItemType::TYPE_ZERO;
     44 }
     45 
     46 }  // namespace mozilla