1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/nsCSSAnonBoxes.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* atom list for CSS anonymous boxes */ 1.10 + 1.11 +#include "mozilla/ArrayUtils.h" 1.12 + 1.13 +#include "nsCSSAnonBoxes.h" 1.14 +#include "nsAtomListUtils.h" 1.15 +#include "nsStaticAtom.h" 1.16 + 1.17 +using namespace mozilla; 1.18 + 1.19 +// define storage for all atoms 1.20 +#define CSS_ANON_BOX(_name, _value) \ 1.21 + nsICSSAnonBoxPseudo* nsCSSAnonBoxes::_name; 1.22 +#include "nsCSSAnonBoxList.h" 1.23 +#undef CSS_ANON_BOX 1.24 + 1.25 +#define CSS_ANON_BOX(name_, value_) \ 1.26 + NS_STATIC_ATOM_BUFFER(name_##_buffer, value_) 1.27 +#include "nsCSSAnonBoxList.h" 1.28 +#undef CSS_ANON_BOX 1.29 + 1.30 +static const nsStaticAtom CSSAnonBoxes_info[] = { 1.31 +#define CSS_ANON_BOX(name_, value_) \ 1.32 + NS_STATIC_ATOM(name_##_buffer, (nsIAtom**)&nsCSSAnonBoxes::name_), 1.33 +#include "nsCSSAnonBoxList.h" 1.34 +#undef CSS_ANON_BOX 1.35 +}; 1.36 + 1.37 +void nsCSSAnonBoxes::AddRefAtoms() 1.38 +{ 1.39 + NS_RegisterStaticAtoms(CSSAnonBoxes_info); 1.40 +} 1.41 + 1.42 +bool nsCSSAnonBoxes::IsAnonBox(nsIAtom *aAtom) 1.43 +{ 1.44 + return nsAtomListUtils::IsMember(aAtom, CSSAnonBoxes_info, 1.45 + ArrayLength(CSSAnonBoxes_info)); 1.46 +} 1.47 + 1.48 +#ifdef MOZ_XUL 1.49 +/* static */ bool 1.50 +nsCSSAnonBoxes::IsTreePseudoElement(nsIAtom* aPseudo) 1.51 +{ 1.52 + return StringBeginsWith(nsDependentAtomString(aPseudo), 1.53 + NS_LITERAL_STRING(":-moz-tree-")); 1.54 +} 1.55 +#endif