LCOV - code coverage report
Current view: top level - layout/style - ServoElementSnapshot.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 44 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "mozilla/ServoElementSnapshot.h"
       8             : #include "mozilla/dom/Element.h"
       9             : #include "nsIContentInlines.h"
      10             : #include "nsContentUtils.h"
      11             : 
      12             : namespace mozilla {
      13             : 
      14           0 : ServoElementSnapshot::ServoElementSnapshot(const Element* aElement)
      15             :   : mState(0)
      16             :   , mContains(Flags(0))
      17             :   , mIsTableBorderNonzero(false)
      18             :   , mIsMozBrowserFrame(false)
      19             :   , mClassAttributeChanged(false)
      20             :   , mIdAttributeChanged(false)
      21           0 :   , mOtherAttributeChanged(false)
      22             : {
      23           0 :   MOZ_COUNT_CTOR(ServoElementSnapshot);
      24           0 :   mIsHTMLElementInHTMLDocument =
      25           0 :     aElement->IsHTMLElement() && aElement->IsInHTMLDocument();
      26           0 :   mIsInChromeDocument = nsContentUtils::IsChromeDoc(aElement->OwnerDoc());
      27           0 :   mSupportsLangAttr = aElement->SupportsLangAttr();
      28           0 : }
      29             : 
      30           0 : ServoElementSnapshot::~ServoElementSnapshot()
      31             : {
      32           0 :   MOZ_COUNT_DTOR(ServoElementSnapshot);
      33           0 : }
      34             : 
      35             : void
      36           0 : ServoElementSnapshot::AddAttrs(Element* aElement,
      37             :                                int32_t aNameSpaceID,
      38             :                                nsIAtom* aAttribute)
      39             : {
      40           0 :   MOZ_ASSERT(aElement);
      41             : 
      42           0 :   if (aNameSpaceID == kNameSpaceID_None) {
      43           0 :     if (aAttribute == nsGkAtoms::_class) {
      44           0 :       mClassAttributeChanged = true;
      45           0 :     } else if (aAttribute == nsGkAtoms::id) {
      46           0 :       mIdAttributeChanged = true;
      47             :     } else {
      48           0 :       mOtherAttributeChanged = true;
      49             :     }
      50             :   } else {
      51           0 :     mOtherAttributeChanged = true;
      52             :   }
      53             : 
      54           0 :   if (HasAttrs()) {
      55           0 :     return;
      56             :   }
      57             : 
      58           0 :   uint32_t attrCount = aElement->GetAttrCount();
      59             :   const nsAttrName* attrName;
      60           0 :   for (uint32_t i = 0; i < attrCount; ++i) {
      61           0 :     attrName = aElement->GetAttrNameAt(i);
      62             :     const nsAttrValue* attrValue =
      63           0 :       aElement->GetParsedAttr(attrName->LocalName(), attrName->NamespaceID());
      64           0 :     mAttrs.AppendElement(ServoAttrSnapshot(*attrName, *attrValue));
      65             :   }
      66           0 :   mContains |= Flags::Attributes;
      67           0 :   if (aElement->HasID()) {
      68           0 :     mContains |= Flags::Id;
      69             :   }
      70           0 :   if (const nsAttrValue* classValue = aElement->GetClasses()) {
      71           0 :     mClass = *classValue;
      72           0 :     mContains |= Flags::MaybeClass;
      73             :   }
      74             : }
      75             : 
      76             : void
      77           0 : ServoElementSnapshot::AddOtherPseudoClassState(Element* aElement)
      78             : {
      79           0 :   MOZ_ASSERT(aElement);
      80             : 
      81           0 :   if (HasOtherPseudoClassState()) {
      82           0 :     return;
      83             :   }
      84             : 
      85           0 :   mIsTableBorderNonzero =
      86           0 :     *nsCSSPseudoClasses::MatchesElement(CSSPseudoClassType::mozTableBorderNonzero,
      87           0 :                                         aElement);
      88           0 :   mIsMozBrowserFrame =
      89           0 :     *nsCSSPseudoClasses::MatchesElement(CSSPseudoClassType::mozBrowserFrame,
      90           0 :                                         aElement);
      91             : 
      92           0 :   mContains |= Flags::OtherPseudoClassState;
      93             : }
      94             : 
      95             : } // namespace mozilla

Generated by: LCOV version 1.13