LCOV - code coverage report
Current view: top level - gfx/layers/wr - WebRenderScrollData.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 80 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 20 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "mozilla/layers/WebRenderScrollData.h"
       7             : 
       8             : #include "Layers.h"
       9             : #include "mozilla/Unused.h"
      10             : #include "Layers.h"
      11             : #include "nsTArray.h"
      12             : #include "UnitTransforms.h"
      13             : 
      14             : namespace mozilla {
      15             : namespace layers {
      16             : 
      17           0 : WebRenderLayerScrollData::WebRenderLayerScrollData()
      18           0 :   : mDescendantCount(-1)
      19             : {
      20           0 : }
      21             : 
      22           0 : WebRenderLayerScrollData::~WebRenderLayerScrollData()
      23             : {
      24           0 : }
      25             : 
      26             : void
      27           0 : WebRenderLayerScrollData::Initialize(WebRenderScrollData& aOwner,
      28             :                                      Layer* aLayer,
      29             :                                      int32_t aDescendantCount)
      30             : {
      31           0 :   MOZ_ASSERT(aDescendantCount >= 0); // Ensure value is valid
      32           0 :   MOZ_ASSERT(mDescendantCount == -1); // Don't allow re-setting an already set value
      33           0 :   mDescendantCount = aDescendantCount;
      34             : 
      35           0 :   MOZ_ASSERT(aLayer);
      36           0 :   for (uint32_t i = 0; i < aLayer->GetScrollMetadataCount(); i++) {
      37           0 :     mScrollIds.AppendElement(aOwner.AddMetadata(aLayer->GetScrollMetadata(i)));
      38             :   }
      39             : 
      40           0 :   mIsScrollInfoLayer = aLayer->AsContainerLayer() && !aLayer->GetFirstChild();
      41           0 :   mTransform = aLayer->GetTransform();
      42           0 :   mTransformIsPerspective = aLayer->GetTransformIsPerspective();
      43           0 :   mEventRegions = aLayer->GetEventRegions();
      44           0 :   mVisibleRegion = aLayer->GetVisibleRegion();
      45           0 :   mReferentId = aLayer->AsRefLayer()
      46           0 :       ? Some(aLayer->AsRefLayer()->GetReferentId())
      47           0 :       : Nothing();
      48           0 :   mEventRegionsOverride = aLayer->AsContainerLayer()
      49           0 :       ? aLayer->AsContainerLayer()->GetEventRegionsOverride()
      50             :       : EventRegionsOverride::NoOverride;
      51           0 :   mScrollThumbData = aLayer->GetScrollThumbData();
      52           0 :   mScrollbarAnimationId = aLayer->GetCompositorAnimationsId();
      53           0 :   mScrollbarTargetContainerId = aLayer->GetScrollbarTargetContainerId();
      54           0 :   mIsScrollbarContainer = aLayer->IsScrollbarContainer();
      55           0 :   mFixedPosScrollContainerId = aLayer->GetFixedPositionScrollContainerId();
      56           0 : }
      57             : 
      58             : int32_t
      59           0 : WebRenderLayerScrollData::GetDescendantCount() const
      60             : {
      61           0 :   MOZ_ASSERT(mDescendantCount >= 0); // check that it was set
      62           0 :   return mDescendantCount;
      63             : }
      64             : 
      65             : size_t
      66           0 : WebRenderLayerScrollData::GetScrollMetadataCount() const
      67             : {
      68           0 :   return mScrollIds.Length();
      69             : }
      70             : 
      71             : const ScrollMetadata&
      72           0 : WebRenderLayerScrollData::GetScrollMetadata(const WebRenderScrollData& aOwner,
      73             :                                             size_t aIndex) const
      74             : {
      75           0 :   MOZ_ASSERT(aIndex < mScrollIds.Length());
      76           0 :   return aOwner.GetScrollMetadata(mScrollIds[aIndex]);
      77             : }
      78             : 
      79             : CSSTransformMatrix
      80           0 : WebRenderLayerScrollData::GetTransformTyped() const
      81             : {
      82           0 :   return ViewAs<CSSTransformMatrix>(GetTransform());
      83             : }
      84             : 
      85           0 : WebRenderScrollData::WebRenderScrollData()
      86             :   : mIsFirstPaint(false)
      87           0 :   , mPaintSequenceNumber(0)
      88             : {
      89           0 : }
      90             : 
      91           0 : WebRenderScrollData::~WebRenderScrollData()
      92             : {
      93           0 : }
      94             : 
      95             : size_t
      96           0 : WebRenderScrollData::AddMetadata(const ScrollMetadata& aMetadata)
      97             : {
      98           0 :   FrameMetrics::ViewID scrollId = aMetadata.GetMetrics().GetScrollId();
      99           0 :   auto insertResult = mScrollIdMap.insert(std::make_pair(scrollId, 0));
     100           0 :   if (insertResult.second) {
     101             :     // Insertion took place, therefore it's a scrollId we hadn't seen before
     102           0 :     insertResult.first->second = mScrollMetadatas.Length();
     103           0 :     mScrollMetadatas.AppendElement(aMetadata);
     104             :   } // else we didn't insert, because it already existed
     105           0 :   return insertResult.first->second;
     106             : }
     107             : 
     108             : size_t
     109           0 : WebRenderScrollData::AddNewLayerData()
     110             : {
     111           0 :   size_t len = mLayerScrollData.Length();
     112           0 :   Unused << mLayerScrollData.AppendElement();
     113           0 :   return len;
     114             : }
     115             : 
     116             : size_t
     117           0 : WebRenderScrollData::GetLayerCount() const
     118             : {
     119           0 :   return mLayerScrollData.Length();
     120             : }
     121             : 
     122             : WebRenderLayerScrollData*
     123           0 : WebRenderScrollData::GetLayerDataMutable(size_t aIndex)
     124             : {
     125           0 :   if (aIndex >= mLayerScrollData.Length()) {
     126           0 :     return nullptr;
     127             :   }
     128           0 :   return &(mLayerScrollData.ElementAt(aIndex));
     129             : }
     130             : 
     131             : const WebRenderLayerScrollData*
     132           0 : WebRenderScrollData::GetLayerData(size_t aIndex) const
     133             : {
     134           0 :   if (aIndex >= mLayerScrollData.Length()) {
     135           0 :     return nullptr;
     136             :   }
     137           0 :   return &(mLayerScrollData.ElementAt(aIndex));
     138             : }
     139             : 
     140             : const ScrollMetadata&
     141           0 : WebRenderScrollData::GetScrollMetadata(size_t aIndex) const
     142             : {
     143           0 :   MOZ_ASSERT(aIndex < mScrollMetadatas.Length());
     144           0 :   return mScrollMetadatas[aIndex];
     145             : }
     146             : 
     147             : void
     148           0 : WebRenderScrollData::SetFocusTarget(const FocusTarget& aFocusTarget)
     149             : {
     150           0 :   mFocusTarget = aFocusTarget;
     151           0 : }
     152             : 
     153             : void
     154           0 : WebRenderScrollData::SetIsFirstPaint()
     155             : {
     156           0 :   mIsFirstPaint = true;
     157           0 : }
     158             : 
     159             : bool
     160           0 : WebRenderScrollData::IsFirstPaint() const
     161             : {
     162           0 :   return mIsFirstPaint;
     163             : }
     164             : 
     165             : void
     166           0 : WebRenderScrollData::SetPaintSequenceNumber(uint32_t aPaintSequenceNumber)
     167             : {
     168           0 :   mPaintSequenceNumber = aPaintSequenceNumber;
     169           0 : }
     170             : 
     171             : uint32_t
     172           0 : WebRenderScrollData::GetPaintSequenceNumber() const
     173             : {
     174           0 :   return mPaintSequenceNumber;
     175             : }
     176             : 
     177             : } // namespace layers
     178             : } // namespace mozilla

Generated by: LCOV version 1.13