Bug Summary

File:var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsForwards.h
Warning:line 145, column 12
Attempt to delete released memory

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name DOMIntersectionObserver.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dom/base -fcoverage-compilation-dir=/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dom/base -resource-dir /usr/lib/llvm-20/lib/clang/20 -include /var/lib/jenkins/workspace/firefox-scan-build/config/gcc_hidden.h -include /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/mozilla-config.h -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D _GLIBCXX_ASSERTIONS -D DEBUG=1 -D MOZ_HAS_MOZGLUE -D MOZILLA_INTERNAL_API -D IMPL_LIBXUL -D MOZ_SUPPORT_LEAKCHECKING -D STATIC_EXPORTABLE_JS_API -I /var/lib/jenkins/workspace/firefox-scan-build/dom/base -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dom/base -I /var/lib/jenkins/workspace/firefox-scan-build/dom/battery -I /var/lib/jenkins/workspace/firefox-scan-build/dom/events -I /var/lib/jenkins/workspace/firefox-scan-build/dom/media -I /var/lib/jenkins/workspace/firefox-scan-build/dom/network -I /var/lib/jenkins/workspace/firefox-scan-build/caps -I /var/lib/jenkins/workspace/firefox-scan-build/docshell/base -I /var/lib/jenkins/workspace/firefox-scan-build/dom/base -I /var/lib/jenkins/workspace/firefox-scan-build/dom/file -I /var/lib/jenkins/workspace/firefox-scan-build/dom/geolocation -I /var/lib/jenkins/workspace/firefox-scan-build/dom/html -I /var/lib/jenkins/workspace/firefox-scan-build/dom/ipc -I /var/lib/jenkins/workspace/firefox-scan-build/dom/storage -I /var/lib/jenkins/workspace/firefox-scan-build/dom/svg -I /var/lib/jenkins/workspace/firefox-scan-build/dom/xml -I /var/lib/jenkins/workspace/firefox-scan-build/dom/xslt/xpath -I /var/lib/jenkins/workspace/firefox-scan-build/dom/xul -I /var/lib/jenkins/workspace/firefox-scan-build/extensions/spellcheck/src -I /var/lib/jenkins/workspace/firefox-scan-build/gfx/2d -I /var/lib/jenkins/workspace/firefox-scan-build/image -I /var/lib/jenkins/workspace/firefox-scan-build/js/xpconnect/loader -I /var/lib/jenkins/workspace/firefox-scan-build/js/xpconnect/src -I /var/lib/jenkins/workspace/firefox-scan-build/js/xpconnect/wrappers -I /var/lib/jenkins/workspace/firefox-scan-build/layout/base -I /var/lib/jenkins/workspace/firefox-scan-build/layout/forms -I /var/lib/jenkins/workspace/firefox-scan-build/layout/generic -I /var/lib/jenkins/workspace/firefox-scan-build/layout/style -I /var/lib/jenkins/workspace/firefox-scan-build/layout/xul -I /var/lib/jenkins/workspace/firefox-scan-build/netwerk/base -I /var/lib/jenkins/workspace/firefox-scan-build/netwerk/protocol/http -I /var/lib/jenkins/workspace/firefox-scan-build/netwerk/url-classifier -I /var/lib/jenkins/workspace/firefox-scan-build/parser/htmlparser -I /var/lib/jenkins/workspace/firefox-scan-build/security/manager/ssl -I /var/lib/jenkins/workspace/firefox-scan-build/third_party/xsimd/include -I /var/lib/jenkins/workspace/firefox-scan-build/widget -I /var/lib/jenkins/workspace/firefox-scan-build/xpcom/build -I /var/lib/jenkins/workspace/firefox-scan-build/xpcom/ds -I /var/lib/jenkins/workspace/firefox-scan-build/netwerk/sctp/datachannel -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/ipc/ipdl/_ipdlheaders -I /var/lib/jenkins/workspace/firefox-scan-build/ipc/chromium/src -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/gtk-3.0/unix-print -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/x86_64-linux-gnu/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/backward -internal-isystem /usr/lib/llvm-20/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-error=tautological-type-limit-compare -Wno-invalid-offsetof -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-deprecated-this-capture -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -fdeprecated-macro -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2025-01-20-090804-167946-1 -x c++ /var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp

/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp

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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7#include "DOMIntersectionObserver.h"
8#include "nsCSSPropertyID.h"
9#include "nsIFrame.h"
10#include "nsContainerFrame.h"
11#include "nsContentUtils.h"
12#include "nsLayoutUtils.h"
13#include "nsRefreshDriver.h"
14#include "mozilla/PresShell.h"
15#include "mozilla/ScrollContainerFrame.h"
16#include "mozilla/StaticPrefs_dom.h"
17#include "mozilla/StaticPrefs_layout.h"
18#include "mozilla/ServoBindings.h"
19#include "mozilla/dom/BrowserChild.h"
20#include "mozilla/dom/BrowsingContext.h"
21#include "mozilla/dom/DocumentInlines.h"
22#include "mozilla/dom/HTMLImageElement.h"
23#include "mozilla/dom/HTMLIFrameElement.h"
24#include "Units.h"
25
26namespace mozilla::dom {
27
28NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMIntersectionObserverEntry)nsresult DOMIntersectionObserverEntry::QueryInterface(const nsIID
& aIID, void** aInstancePtr) { do { if (!(aInstancePtr)) {
NS_DebugBreak(NS_DEBUG_ASSERTION, "QueryInterface requires a non-NULL destination!"
, "aInstancePtr", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 28); MOZ_PretendNoReturn(); } } while (0); nsISupports* foundInterface
; if (TopThreeWordsEquals( aIID, (nsXPCOMCycleCollectionParticipant
::COMTypeInfo<nsXPCOMCycleCollectionParticipant, void>::
kIID), (nsCycleCollectionISupports::COMTypeInfo<nsCycleCollectionISupports
, void>::kIID)) && (LowWordEquals(aIID, (nsXPCOMCycleCollectionParticipant
::COMTypeInfo<nsXPCOMCycleCollectionParticipant, void>::
kIID)) || LowWordEquals(aIID, (nsCycleCollectionISupports::COMTypeInfo
<nsCycleCollectionISupports, void>::kIID)))) { if (LowWordEquals
(aIID, (nsXPCOMCycleCollectionParticipant::COMTypeInfo<nsXPCOMCycleCollectionParticipant
, void>::kIID))) { *aInstancePtr = DOMIntersectionObserverEntry
::cycleCollection::GetParticipant(); return NS_OK; } if (LowWordEquals
(aIID, (nsCycleCollectionISupports::COMTypeInfo<nsCycleCollectionISupports
, void>::kIID))) { *aInstancePtr = DOMIntersectionObserverEntry
::cycleCollection::Upcast(this); return NS_OK; } foundInterface
= nullptr; } else
29 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRYif (aIID.Equals((nsWrapperCache::COMTypeInfo<nsWrapperCache
, void>::kIID))) { *aInstancePtr = static_cast<nsWrapperCache
*>(this); return NS_OK; } else
30 NS_INTERFACE_MAP_ENTRY(nsISupports)if (aIID.Equals(mozilla::detail::kImplementedIID<std::remove_reference_t
<decltype(*this)>, nsISupports>)) foundInterface = static_cast
<nsISupports*>(this); else
31NS_INTERFACE_MAP_ENDfoundInterface = 0; nsresult status; if (!foundInterface) { do
{ static_assert( mozilla::detail::AssertionConditionType<
decltype(!aIID.Equals((nsISupports::COMTypeInfo<nsISupports
, void>::kIID)))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!aIID.Equals((nsISupports::COMTypeInfo
<nsISupports, void>::kIID))))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("!aIID.Equals((nsISupports::COMTypeInfo<nsISupports, void>::kIID))"
, "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 31); AnnotateMozCrashReason("MOZ_ASSERT" "(" "!aIID.Equals((nsISupports::COMTypeInfo<nsISupports, void>::kIID))"
")"); do { *((volatile int*)__null) = 31; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false); status = NS_NOINTERFACE
; } else { (foundInterface)->AddRef(); status = NS_OK; } *
aInstancePtr = foundInterface; return status; }
32
33NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMIntersectionObserverEntry)MozExternalRefCountType DOMIntersectionObserverEntry::AddRef(
void) { static_assert(!std::is_destructible_v<DOMIntersectionObserverEntry
>, "Reference-counted class " "DOMIntersectionObserverEntry"
" should not have a public destructor. " "Make this class's destructor non-public"
); do { static_assert( mozilla::detail::AssertionConditionType
<decltype(int32_t(mRefCnt) >= 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(int32_t(mRefCnt) >= 0))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("int32_t(mRefCnt) >= 0"
" (" "illegal refcnt" ")", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 33); AnnotateMozCrashReason("MOZ_ASSERT" "(" "int32_t(mRefCnt) >= 0"
") (" "illegal refcnt" ")"); do { *((volatile int*)__null) =
33; __attribute__((nomerge)) ::abort(); } while (false); } }
while (false); _mOwningThread.AssertOwnership("DOMIntersectionObserverEntry"
" not thread-safe"); nsISupports* base = DOMIntersectionObserverEntry
::cycleCollection::Upcast(this); nsrefcnt count = mRefCnt.incr
(base); NS_LogAddRef((this), (count), ("DOMIntersectionObserverEntry"
), (uint32_t)(sizeof(*this))); return count; }
34NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMIntersectionObserverEntry)MozExternalRefCountType DOMIntersectionObserverEntry::Release
(void) { do { static_assert( mozilla::detail::AssertionConditionType
<decltype(int32_t(mRefCnt) > 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(int32_t(mRefCnt) > 0))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("int32_t(mRefCnt) > 0"
" (" "dup release" ")", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 34); AnnotateMozCrashReason("MOZ_ASSERT" "(" "int32_t(mRefCnt) > 0"
") (" "dup release" ")"); do { *((volatile int*)__null) = 34
; __attribute__((nomerge)) ::abort(); } while (false); } } while
(false); _mOwningThread.AssertOwnership("DOMIntersectionObserverEntry"
" not thread-safe"); nsISupports* base = DOMIntersectionObserverEntry
::cycleCollection::Upcast(this); nsrefcnt count = mRefCnt.decr
(base); NS_LogRelease((this), (count), ("DOMIntersectionObserverEntry"
)); return count; } void DOMIntersectionObserverEntry::DeleteCycleCollectable
(void) { delete (this); }
35
36NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMIntersectionObserverEntry, mOwner,static_assert(std::is_base_of<nsWrapperCache, DOMIntersectionObserverEntry
>::value, "Class should inherit nsWrapperCache"); DOMIntersectionObserverEntry
::cycleCollection DOMIntersectionObserverEntry::_cycleCollectorGlobal
( nsCycleCollectionParticipant::FlagMaybeSingleZoneJSHolder);
void DOMIntersectionObserverEntry::cycleCollection::Trace( void
* p, const TraceCallbacks& aCallbacks, void* aClosure) { DOMIntersectionObserverEntry
* tmp = DowncastCCParticipant<DOMIntersectionObserverEntry
>(p); TraceWrapper(p, aCallbacks, aClosure); (void)tmp; } void
DOMIntersectionObserverEntry::cycleCollection::TraceWrapper(
void* p, const TraceCallbacks& aCallbacks, void* aClosure
) { DOMIntersectionObserverEntry* tmp = DowncastCCParticipant
<DOMIntersectionObserverEntry>(p); tmp->TraceWrapper
(aCallbacks, aClosure); } void DOMIntersectionObserverEntry::
cycleCollection::Unlink(void* p) { DOMIntersectionObserverEntry
* tmp = DowncastCCParticipant<DOMIntersectionObserverEntry
>(p); ImplCycleCollectionUnlink(tmp->mOwner); ImplCycleCollectionUnlink
(tmp->mRootBounds); ImplCycleCollectionUnlink(tmp->mBoundingClientRect
); ImplCycleCollectionUnlink(tmp->mIntersectionRect); ImplCycleCollectionUnlink
(tmp->mTarget); tmp->ReleaseWrapper(p); (void)tmp; } nsresult
DOMIntersectionObserverEntry::cycleCollection::TraverseNative
( void* p, nsCycleCollectionTraversalCallback& cb) { DOMIntersectionObserverEntry
* tmp = DowncastCCParticipant<DOMIntersectionObserverEntry
>(p); cb.DescribeRefCountedNode(tmp->mRefCnt.get(), "DOMIntersectionObserverEntry"
); ImplCycleCollectionTraverse(cb, tmp->mOwner, "mOwner", 0
); ImplCycleCollectionTraverse(cb, tmp->mRootBounds, "mRootBounds"
, 0); ImplCycleCollectionTraverse(cb, tmp->mBoundingClientRect
, "mBoundingClientRect", 0); ImplCycleCollectionTraverse(cb, tmp
->mIntersectionRect, "mIntersectionRect", 0); ImplCycleCollectionTraverse
(cb, tmp->mTarget, "mTarget", 0); (void)tmp; return NS_OK;
}
37 mRootBounds, mBoundingClientRect,static_assert(std::is_base_of<nsWrapperCache, DOMIntersectionObserverEntry
>::value, "Class should inherit nsWrapperCache"); DOMIntersectionObserverEntry
::cycleCollection DOMIntersectionObserverEntry::_cycleCollectorGlobal
( nsCycleCollectionParticipant::FlagMaybeSingleZoneJSHolder);
void DOMIntersectionObserverEntry::cycleCollection::Trace( void
* p, const TraceCallbacks& aCallbacks, void* aClosure) { DOMIntersectionObserverEntry
* tmp = DowncastCCParticipant<DOMIntersectionObserverEntry
>(p); TraceWrapper(p, aCallbacks, aClosure); (void)tmp; } void
DOMIntersectionObserverEntry::cycleCollection::TraceWrapper(
void* p, const TraceCallbacks& aCallbacks, void* aClosure
) { DOMIntersectionObserverEntry* tmp = DowncastCCParticipant
<DOMIntersectionObserverEntry>(p); tmp->TraceWrapper
(aCallbacks, aClosure); } void DOMIntersectionObserverEntry::
cycleCollection::Unlink(void* p) { DOMIntersectionObserverEntry
* tmp = DowncastCCParticipant<DOMIntersectionObserverEntry
>(p); ImplCycleCollectionUnlink(tmp->mOwner); ImplCycleCollectionUnlink
(tmp->mRootBounds); ImplCycleCollectionUnlink(tmp->mBoundingClientRect
); ImplCycleCollectionUnlink(tmp->mIntersectionRect); ImplCycleCollectionUnlink
(tmp->mTarget); tmp->ReleaseWrapper(p); (void)tmp; } nsresult
DOMIntersectionObserverEntry::cycleCollection::TraverseNative
( void* p, nsCycleCollectionTraversalCallback& cb) { DOMIntersectionObserverEntry
* tmp = DowncastCCParticipant<DOMIntersectionObserverEntry
>(p); cb.DescribeRefCountedNode(tmp->mRefCnt.get(), "DOMIntersectionObserverEntry"
); ImplCycleCollectionTraverse(cb, tmp->mOwner, "mOwner", 0
); ImplCycleCollectionTraverse(cb, tmp->mRootBounds, "mRootBounds"
, 0); ImplCycleCollectionTraverse(cb, tmp->mBoundingClientRect
, "mBoundingClientRect", 0); ImplCycleCollectionTraverse(cb, tmp
->mIntersectionRect, "mIntersectionRect", 0); ImplCycleCollectionTraverse
(cb, tmp->mTarget, "mTarget", 0); (void)tmp; return NS_OK;
}
38 mIntersectionRect, mTarget)static_assert(std::is_base_of<nsWrapperCache, DOMIntersectionObserverEntry
>::value, "Class should inherit nsWrapperCache"); DOMIntersectionObserverEntry
::cycleCollection DOMIntersectionObserverEntry::_cycleCollectorGlobal
( nsCycleCollectionParticipant::FlagMaybeSingleZoneJSHolder);
void DOMIntersectionObserverEntry::cycleCollection::Trace( void
* p, const TraceCallbacks& aCallbacks, void* aClosure) { DOMIntersectionObserverEntry
* tmp = DowncastCCParticipant<DOMIntersectionObserverEntry
>(p); TraceWrapper(p, aCallbacks, aClosure); (void)tmp; } void
DOMIntersectionObserverEntry::cycleCollection::TraceWrapper(
void* p, const TraceCallbacks& aCallbacks, void* aClosure
) { DOMIntersectionObserverEntry* tmp = DowncastCCParticipant
<DOMIntersectionObserverEntry>(p); tmp->TraceWrapper
(aCallbacks, aClosure); } void DOMIntersectionObserverEntry::
cycleCollection::Unlink(void* p) { DOMIntersectionObserverEntry
* tmp = DowncastCCParticipant<DOMIntersectionObserverEntry
>(p); ImplCycleCollectionUnlink(tmp->mOwner); ImplCycleCollectionUnlink
(tmp->mRootBounds); ImplCycleCollectionUnlink(tmp->mBoundingClientRect
); ImplCycleCollectionUnlink(tmp->mIntersectionRect); ImplCycleCollectionUnlink
(tmp->mTarget); tmp->ReleaseWrapper(p); (void)tmp; } nsresult
DOMIntersectionObserverEntry::cycleCollection::TraverseNative
( void* p, nsCycleCollectionTraversalCallback& cb) { DOMIntersectionObserverEntry
* tmp = DowncastCCParticipant<DOMIntersectionObserverEntry
>(p); cb.DescribeRefCountedNode(tmp->mRefCnt.get(), "DOMIntersectionObserverEntry"
); ImplCycleCollectionTraverse(cb, tmp->mOwner, "mOwner", 0
); ImplCycleCollectionTraverse(cb, tmp->mRootBounds, "mRootBounds"
, 0); ImplCycleCollectionTraverse(cb, tmp->mBoundingClientRect
, "mBoundingClientRect", 0); ImplCycleCollectionTraverse(cb, tmp
->mIntersectionRect, "mIntersectionRect", 0); ImplCycleCollectionTraverse
(cb, tmp->mTarget, "mTarget", 0); (void)tmp; return NS_OK;
}
39
40NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMIntersectionObserver)nsresult DOMIntersectionObserver::QueryInterface(const nsIID&
aIID, void** aInstancePtr) { do { if (!(aInstancePtr)) { NS_DebugBreak
(NS_DEBUG_ASSERTION, "QueryInterface requires a non-NULL destination!"
, "aInstancePtr", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 40); MOZ_PretendNoReturn(); } } while (0); nsISupports* foundInterface
; if (TopThreeWordsEquals( aIID, (nsXPCOMCycleCollectionParticipant
::COMTypeInfo<nsXPCOMCycleCollectionParticipant, void>::
kIID), (nsCycleCollectionISupports::COMTypeInfo<nsCycleCollectionISupports
, void>::kIID)) && (LowWordEquals(aIID, (nsXPCOMCycleCollectionParticipant
::COMTypeInfo<nsXPCOMCycleCollectionParticipant, void>::
kIID)) || LowWordEquals(aIID, (nsCycleCollectionISupports::COMTypeInfo
<nsCycleCollectionISupports, void>::kIID)))) { if (LowWordEquals
(aIID, (nsXPCOMCycleCollectionParticipant::COMTypeInfo<nsXPCOMCycleCollectionParticipant
, void>::kIID))) { *aInstancePtr = DOMIntersectionObserver
::cycleCollection::GetParticipant(); return NS_OK; } if (LowWordEquals
(aIID, (nsCycleCollectionISupports::COMTypeInfo<nsCycleCollectionISupports
, void>::kIID))) { *aInstancePtr = DOMIntersectionObserver
::cycleCollection::Upcast(this); return NS_OK; } foundInterface
= nullptr; } else
41 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRYif (aIID.Equals((nsWrapperCache::COMTypeInfo<nsWrapperCache
, void>::kIID))) { *aInstancePtr = static_cast<nsWrapperCache
*>(this); return NS_OK; } else
42 NS_INTERFACE_MAP_ENTRY(nsISupports)if (aIID.Equals(mozilla::detail::kImplementedIID<std::remove_reference_t
<decltype(*this)>, nsISupports>)) foundInterface = static_cast
<nsISupports*>(this); else
43 NS_INTERFACE_MAP_ENTRY(DOMIntersectionObserver)if (aIID.Equals(mozilla::detail::kImplementedIID<std::remove_reference_t
<decltype(*this)>, DOMIntersectionObserver>)) foundInterface
= static_cast<DOMIntersectionObserver*>(this); else
44NS_INTERFACE_MAP_ENDfoundInterface = 0; nsresult status; if (!foundInterface) { do
{ static_assert( mozilla::detail::AssertionConditionType<
decltype(!aIID.Equals((nsISupports::COMTypeInfo<nsISupports
, void>::kIID)))>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!aIID.Equals((nsISupports::COMTypeInfo
<nsISupports, void>::kIID))))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("!aIID.Equals((nsISupports::COMTypeInfo<nsISupports, void>::kIID))"
, "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 44); AnnotateMozCrashReason("MOZ_ASSERT" "(" "!aIID.Equals((nsISupports::COMTypeInfo<nsISupports, void>::kIID))"
")"); do { *((volatile int*)__null) = 44; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false); status = NS_NOINTERFACE
; } else { (foundInterface)->AddRef(); status = NS_OK; } *
aInstancePtr = foundInterface; return status; }
45
46NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMIntersectionObserver)MozExternalRefCountType DOMIntersectionObserver::AddRef(void)
{ static_assert(!std::is_destructible_v<DOMIntersectionObserver
>, "Reference-counted class " "DOMIntersectionObserver" " should not have a public destructor. "
"Make this class's destructor non-public"); do { static_assert
( mozilla::detail::AssertionConditionType<decltype(int32_t
(mRefCnt) >= 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(int32_t(mRefCnt) >= 0))),
0))) { do { } while (false); MOZ_ReportAssertionFailure("int32_t(mRefCnt) >= 0"
" (" "illegal refcnt" ")", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 46); AnnotateMozCrashReason("MOZ_ASSERT" "(" "int32_t(mRefCnt) >= 0"
") (" "illegal refcnt" ")"); do { *((volatile int*)__null) =
46; __attribute__((nomerge)) ::abort(); } while (false); } }
while (false); _mOwningThread.AssertOwnership("DOMIntersectionObserver"
" not thread-safe"); nsISupports* base = DOMIntersectionObserver
::cycleCollection::Upcast(this); nsrefcnt count = mRefCnt.incr
(base); NS_LogAddRef((this), (count), ("DOMIntersectionObserver"
), (uint32_t)(sizeof(*this))); return count; }
47NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMIntersectionObserver)MozExternalRefCountType DOMIntersectionObserver::Release(void
) { do { static_assert( mozilla::detail::AssertionConditionType
<decltype(int32_t(mRefCnt) > 0)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(int32_t(mRefCnt) > 0))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("int32_t(mRefCnt) > 0"
" (" "dup release" ")", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 47); AnnotateMozCrashReason("MOZ_ASSERT" "(" "int32_t(mRefCnt) > 0"
") (" "dup release" ")"); do { *((volatile int*)__null) = 47
; __attribute__((nomerge)) ::abort(); } while (false); } } while
(false); _mOwningThread.AssertOwnership("DOMIntersectionObserver"
" not thread-safe"); nsISupports* base = DOMIntersectionObserver
::cycleCollection::Upcast(this); nsrefcnt count = mRefCnt.decr
(base); NS_LogRelease((this), (count), ("DOMIntersectionObserver"
)); return count; } void DOMIntersectionObserver::DeleteCycleCollectable
(void) { delete (this); }
48
49NS_IMPL_CYCLE_COLLECTION_CLASS(DOMIntersectionObserver)DOMIntersectionObserver::cycleCollection DOMIntersectionObserver
::_cycleCollectorGlobal;
50
51NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMIntersectionObserver)void DOMIntersectionObserver::cycleCollection::Trace( void* p
, const TraceCallbacks& aCallbacks, void* aClosure) { DOMIntersectionObserver
* tmp = DowncastCCParticipant<DOMIntersectionObserver>(
p);
52 NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPERtmp->TraceWrapper(aCallbacks, aClosure);
53NS_IMPL_CYCLE_COLLECTION_TRACE_END(void)tmp; }
54
55NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMIntersectionObserver)void DOMIntersectionObserver::cycleCollection::Unlink(void* p
) { DOMIntersectionObserver* tmp = DowncastCCParticipant<DOMIntersectionObserver
>(p);
56 NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPERtmp->ReleaseWrapper(p);
57 tmp->Disconnect();
58 NS_IMPL_CYCLE_COLLECTION_UNLINK(mOwner)ImplCycleCollectionUnlink(tmp->mOwner);
59 NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocument)ImplCycleCollectionUnlink(tmp->mDocument);
60 if (tmp->mCallback.is<RefPtr<dom::IntersectionCallback>>()) {
61 ImplCycleCollectionUnlink(
62 tmp->mCallback.as<RefPtr<dom::IntersectionCallback>>());
63 }
64 NS_IMPL_CYCLE_COLLECTION_UNLINK(mRoot)ImplCycleCollectionUnlink(tmp->mRoot);
65 NS_IMPL_CYCLE_COLLECTION_UNLINK(mQueuedEntries)ImplCycleCollectionUnlink(tmp->mQueuedEntries);
66NS_IMPL_CYCLE_COLLECTION_UNLINK_END(void)tmp; }
67
68NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMIntersectionObserver)nsresult DOMIntersectionObserver::cycleCollection::TraverseNative
( void* p, nsCycleCollectionTraversalCallback& cb) { DOMIntersectionObserver
* tmp = DowncastCCParticipant<DOMIntersectionObserver>(
p); cb.DescribeRefCountedNode(tmp->mRefCnt.get(), "DOMIntersectionObserver"
);
69 NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOwner)ImplCycleCollectionTraverse(cb, tmp->mOwner, "mOwner", 0);
70 NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocument)ImplCycleCollectionTraverse(cb, tmp->mDocument, "mDocument"
, 0);
71 if (tmp->mCallback.is<RefPtr<dom::IntersectionCallback>>()) {
72 ImplCycleCollectionTraverse(
73 cb, tmp->mCallback.as<RefPtr<dom::IntersectionCallback>>(), "mCallback",
74 0);
75 }
76 NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRoot)ImplCycleCollectionTraverse(cb, tmp->mRoot, "mRoot", 0);
77 NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mQueuedEntries)ImplCycleCollectionTraverse(cb, tmp->mQueuedEntries, "mQueuedEntries"
, 0);
78NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END(void)tmp; return NS_OK; }
79
80DOMIntersectionObserver::DOMIntersectionObserver(
81 already_AddRefed<nsPIDOMWindowInner>&& aOwner,
82 dom::IntersectionCallback& aCb)
83 : mOwner(aOwner),
84 mDocument(mOwner->GetExtantDoc()),
85 mCallback(RefPtr<dom::IntersectionCallback>(&aCb)) {}
86
87already_AddRefed<DOMIntersectionObserver> DOMIntersectionObserver::Constructor(
88 const GlobalObject& aGlobal, dom::IntersectionCallback& aCb,
89 ErrorResult& aRv) {
90 return Constructor(aGlobal, aCb, IntersectionObserverInit(), aRv);
91}
92
93already_AddRefed<DOMIntersectionObserver> DOMIntersectionObserver::Constructor(
94 const GlobalObject& aGlobal, dom::IntersectionCallback& aCb,
95 const IntersectionObserverInit& aOptions, ErrorResult& aRv) {
96 nsCOMPtr<nsPIDOMWindowInner> window =
97 do_QueryInterface(aGlobal.GetAsSupports());
98 if (!window) {
99 aRv.Throw(NS_ERROR_FAILURE);
100 return nullptr;
101 }
102 RefPtr<DOMIntersectionObserver> observer =
103 new DOMIntersectionObserver(window.forget(), aCb);
104
105 if (!aOptions.mRoot.IsNull()) {
106 if (aOptions.mRoot.Value().IsElement()) {
107 observer->mRoot = aOptions.mRoot.Value().GetAsElement();
108 } else {
109 MOZ_ASSERT(aOptions.mRoot.Value().IsDocument())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aOptions.mRoot.Value().IsDocument())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aOptions.mRoot.Value().IsDocument
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("aOptions.mRoot.Value().IsDocument()", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 109); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aOptions.mRoot.Value().IsDocument()"
")"); do { *((volatile int*)__null) = 109; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
110 observer->mRoot = aOptions.mRoot.Value().GetAsDocument();
111 }
112 }
113
114 if (!observer->SetRootMargin(aOptions.mRootMargin)) {
115 aRv.ThrowSyntaxError("rootMargin must be specified in pixels or percent.");
116 return nullptr;
117 }
118
119 if (aOptions.mThreshold.IsDoubleSequence()) {
120 const Sequence<double>& thresholds =
121 aOptions.mThreshold.GetAsDoubleSequence();
122 observer->mThresholds.SetCapacity(thresholds.Length());
123 for (const auto& thresh : thresholds) {
124 if (thresh < 0.0 || thresh > 1.0) {
125 aRv.ThrowRangeError<dom::MSG_THRESHOLD_RANGE_ERROR>();
126 return nullptr;
127 }
128 observer->mThresholds.AppendElement(thresh);
129 }
130 observer->mThresholds.Sort();
131 if (observer->mThresholds.IsEmpty()) {
132 observer->mThresholds.AppendElement(0.0);
133 }
134 } else {
135 double thresh = aOptions.mThreshold.GetAsDouble();
136 if (thresh < 0.0 || thresh > 1.0) {
137 aRv.ThrowRangeError<dom::MSG_THRESHOLD_RANGE_ERROR>();
138 return nullptr;
139 }
140 observer->mThresholds.AppendElement(thresh);
141 }
142
143 return observer.forget();
144}
145
146static void LazyLoadCallback(
147 const Sequence<OwningNonNull<DOMIntersectionObserverEntry>>& aEntries) {
148 for (const auto& entry : aEntries) {
149 Element* target = entry->Target();
150 if (entry->IsIntersecting()) {
151 if (auto* image = HTMLImageElement::FromNode(target)) {
152 image->StopLazyLoading();
153 } else if (auto* iframe = HTMLIFrameElement::FromNode(target)) {
154 iframe->StopLazyLoading();
155 } else {
156 MOZ_ASSERT_UNREACHABLE(do { static_assert( mozilla::detail::AssertionConditionType<
decltype(false)>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (
false); MOZ_ReportAssertionFailure("false" " (" "MOZ_ASSERT_UNREACHABLE: "
"Only <img> and <iframe> should be observed by lazy load observer"
")", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 157); AnnotateMozCrashReason("MOZ_ASSERT" "(" "false" ") ("
"MOZ_ASSERT_UNREACHABLE: " "Only <img> and <iframe> should be observed by lazy load observer"
")"); do { *((volatile int*)__null) = 157; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
157 "Only <img> and <iframe> should be observed by lazy load observer")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(false)>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (
false); MOZ_ReportAssertionFailure("false" " (" "MOZ_ASSERT_UNREACHABLE: "
"Only <img> and <iframe> should be observed by lazy load observer"
")", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 157); AnnotateMozCrashReason("MOZ_ASSERT" "(" "false" ") ("
"MOZ_ASSERT_UNREACHABLE: " "Only <img> and <iframe> should be observed by lazy load observer"
")"); do { *((volatile int*)__null) = 157; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
158 }
159 }
160 }
161}
162
163static LengthPercentage PrefMargin(float aValue, bool aIsPercentage) {
164 return aIsPercentage ? LengthPercentage::FromPercentage(aValue / 100.0f)
165 : LengthPercentage::FromPixels(aValue);
166}
167
168StyleRect<LengthPercentage> DOMIntersectionObserver::LazyLoadingRootMargin() {
169 StyleRect<LengthPercentage> margin;
170#define SET_MARGIN(side_, side_lower_) \
171 margin.Get(eSide##side_) = PrefMargin( \
172 StaticPrefs::dom_image_lazy_loading_root_margin_##side_lower_(), \
173 StaticPrefs:: \
174 dom_image_lazy_loading_root_margin_##side_lower_##_percentage());
175 SET_MARGIN(Top, top);
176 SET_MARGIN(Right, right);
177 SET_MARGIN(Bottom, bottom);
178 SET_MARGIN(Left, left);
179#undef SET_MARGIN
180 return margin;
181}
182
183DOMIntersectionObserver::DOMIntersectionObserver(Document& aDocument,
184 NativeCallback aCallback)
185 : mOwner(aDocument.GetInnerWindow()),
186 mDocument(&aDocument),
187 mCallback(aCallback) {}
188
189already_AddRefed<DOMIntersectionObserver>
190DOMIntersectionObserver::CreateLazyLoadObserver(Document& aDocument) {
191 RefPtr<DOMIntersectionObserver> observer =
192 new DOMIntersectionObserver(aDocument, LazyLoadCallback);
193 observer->mThresholds.AppendElement(0.0f);
194 observer->mRootMargin = LazyLoadingRootMargin();
1
Calling implicit destructor for 'StyleRect<mozilla::StyleLengthPercentageUnion>'
2
Calling '~StyleLengthPercentageUnion'
195 return observer.forget();
196}
197
198bool DOMIntersectionObserver::SetRootMargin(const nsACString& aString) {
199 return Servo_IntersectionObserverRootMargin_Parse(&aString, &mRootMargin);
200}
201
202nsISupports* DOMIntersectionObserver::GetParentObject() const { return mOwner; }
203
204void DOMIntersectionObserver::GetRootMargin(nsACString& aRetVal) {
205 Servo_IntersectionObserverRootMargin_ToString(&mRootMargin, &aRetVal);
206}
207
208void DOMIntersectionObserver::GetThresholds(nsTArray<double>& aRetVal) {
209 aRetVal = mThresholds.Clone();
210}
211
212void DOMIntersectionObserver::Observe(Element& aTarget) {
213 bool wasPresent =
214 mObservationTargetMap.WithEntryHandle(&aTarget, [](auto handle) {
215 if (handle.HasEntry()) {
216 return true;
217 }
218 handle.Insert(Uninitialized);
219 return false;
220 });
221 if (wasPresent) {
222 return;
223 }
224 aTarget.BindObject(this, [](nsISupports* aObserver, nsINode* aTarget) {
225 static_cast<DOMIntersectionObserver*>(aObserver)->UnlinkTarget(
226 *aTarget->AsElement());
227 });
228 mObservationTargets.AppendElement(&aTarget);
229
230 MOZ_ASSERT(mObservationTargets.Length() == mObservationTargetMap.Count())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mObservationTargets.Length() == mObservationTargetMap
.Count())>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(mObservationTargets.Length() == mObservationTargetMap
.Count()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mObservationTargets.Length() == mObservationTargetMap.Count()"
, "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 230); AnnotateMozCrashReason("MOZ_ASSERT" "(" "mObservationTargets.Length() == mObservationTargetMap.Count()"
")"); do { *((volatile int*)__null) = 230; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
231
232 Connect();
233 if (mDocument) {
234 if (nsPresContext* pc = mDocument->GetPresContext()) {
235 pc->RefreshDriver()->EnsureIntersectionObservationsUpdateHappens();
236 }
237 }
238}
239
240void DOMIntersectionObserver::Unobserve(Element& aTarget) {
241 if (!mObservationTargetMap.Remove(&aTarget)) {
242 return;
243 }
244
245 mObservationTargets.RemoveElement(&aTarget);
246 aTarget.UnbindObject(this);
247
248 MOZ_ASSERT(mObservationTargets.Length() == mObservationTargetMap.Count())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mObservationTargets.Length() == mObservationTargetMap
.Count())>::isValid, "invalid assertion condition"); if ((
__builtin_expect(!!(!(!!(mObservationTargets.Length() == mObservationTargetMap
.Count()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("mObservationTargets.Length() == mObservationTargetMap.Count()"
, "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 248); AnnotateMozCrashReason("MOZ_ASSERT" "(" "mObservationTargets.Length() == mObservationTargetMap.Count()"
")"); do { *((volatile int*)__null) = 248; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
249
250 if (mObservationTargets.IsEmpty()) {
251 Disconnect();
252 }
253}
254
255void DOMIntersectionObserver::UnlinkTarget(Element& aTarget) {
256 mObservationTargets.RemoveElement(&aTarget);
257 mObservationTargetMap.Remove(&aTarget);
258 if (mObservationTargets.IsEmpty()) {
259 Disconnect();
260 }
261}
262
263void DOMIntersectionObserver::Connect() {
264 if (mConnected) {
265 return;
266 }
267
268 mConnected = true;
269 if (mDocument) {
270 mDocument->AddIntersectionObserver(*this);
271 }
272}
273
274void DOMIntersectionObserver::Disconnect() {
275 if (!mConnected) {
276 return;
277 }
278
279 mConnected = false;
280 for (Element* target : mObservationTargets) {
281 target->UnbindObject(this);
282 }
283 mObservationTargets.Clear();
284 mObservationTargetMap.Clear();
285 if (mDocument) {
286 mDocument->RemoveIntersectionObserver(*this);
287 }
288}
289
290void DOMIntersectionObserver::TakeRecords(
291 nsTArray<RefPtr<DOMIntersectionObserverEntry>>& aRetVal) {
292 aRetVal = std::move(mQueuedEntries);
293}
294
295enum class BrowsingContextOrigin { Similar, Different };
296
297// NOTE(emilio): Checking docgroup as per discussion in:
298// https://github.com/w3c/IntersectionObserver/issues/161
299static BrowsingContextOrigin SimilarOrigin(const Element& aTarget,
300 const nsINode* aRoot) {
301 if (!aRoot) {
302 return BrowsingContextOrigin::Different;
303 }
304 return aTarget.OwnerDoc()->GetDocGroup() == aRoot->OwnerDoc()->GetDocGroup()
305 ? BrowsingContextOrigin::Similar
306 : BrowsingContextOrigin::Different;
307}
308
309// NOTE: This returns nullptr if |aDocument| is in another process from the top
310// level content document.
311static const Document* GetTopLevelContentDocumentInThisProcess(
312 const Document& aDocument) {
313 auto* wc = aDocument.GetTopLevelWindowContext();
314 return wc ? wc->GetExtantDoc() : nullptr;
315}
316
317// https://w3c.github.io/IntersectionObserver/#compute-the-intersection
318//
319// TODO(emilio): Proof of this being equivalent to the spec welcome, seems
320// reasonably close.
321//
322// Also, it's unclear to me why the spec talks about browsing context while
323// discarding observations of targets of different documents.
324//
325// Both aRootBounds and the return value are relative to
326// nsLayoutUtils::GetContainingBlockForClientRect(aRoot).
327//
328// In case of out-of-process document, aRemoteDocumentVisibleRect is a rectangle
329// in the out-of-process document's coordinate system.
330static Maybe<nsRect> ComputeTheIntersection(
331 nsIFrame* aTarget, const nsRect& aTargetRectRelativeToTarget,
332 nsIFrame* aRoot, const nsRect& aRootBounds,
333 const Maybe<nsRect>& aRemoteDocumentVisibleRect,
334 DOMIntersectionObserver::IsForProximityToViewport
335 aIsForProximityToViewport) {
336 nsIFrame* target = aTarget;
337 // 1. Let intersectionRect be the result of running the
338 // getBoundingClientRect() algorithm on the target.
339 //
340 // `intersectionRect` is kept relative to `target` during the loop.
341 auto inflowRect = aTargetRectRelativeToTarget;
342 Maybe<nsRect> intersectionRect = Some(inflowRect);
343
344 // 2. Let container be the containing block of the target.
345 // (We go through the parent chain and only look at scroll frames)
346 //
347 // FIXME(emilio): Spec uses containing blocks, we use scroll frames, but we
348 // only apply overflow-clipping, not clip-path, so it's ~fine. We do need to
349 // apply clip-path.
350 //
351 // 3. While container is not the intersection root:
352 nsIFrame* containerFrame =
353 nsLayoutUtils::GetCrossDocParentFrameInProcess(target);
354 while (containerFrame && containerFrame != aRoot) {
355 // FIXME(emilio): What about other scroll frames that inherit from
356 // ScrollContainerFrame but have a different type, like nsListControlFrame?
357 // This looks bogus in that case, but different bug.
358 if (ScrollContainerFrame* scrollContainerFrame =
359 do_QueryFrame(containerFrame)) {
360 if (containerFrame->GetParent() == aRoot && !aRoot->GetParent()) {
361 // This is subtle: if we're computing the intersection against the
362 // viewport (the root frame), and this is its scroll frame, we really
363 // want to skip this intersection (because we want to account for the
364 // root margin, which is already in aRootBounds).
365 break;
366 }
367 nsRect subFrameRect =
368 scrollContainerFrame->GetScrollPortRectAccountingForDynamicToolbar();
369
370 // 3.1 Map intersectionRect to the coordinate space of container.
371 nsRect intersectionRectRelativeToContainer =
372 nsLayoutUtils::TransformFrameRectToAncestor(
373 target, intersectionRect.value(), containerFrame);
374
375 // 3.2 If container has overflow clipping or a css clip-path property,
376 // update intersectionRect by applying container's clip.
377 //
378 // 3.3 is handled, looks like, by this same clipping, given the root
379 // scroll-frame cannot escape the viewport, probably?
380 intersectionRect =
381 intersectionRectRelativeToContainer.EdgeInclusiveIntersection(
382 subFrameRect);
383 if (!intersectionRect) {
384 return Nothing();
385 }
386 target = containerFrame;
387 } else {
388 const auto& disp = *containerFrame->StyleDisplay();
389 auto clipAxes = containerFrame->ShouldApplyOverflowClipping(&disp);
390 // 3.2 TODO: Apply clip-path.
391 if (!clipAxes.isEmpty()) {
392 // 3.1 Map intersectionRect to the coordinate space of container.
393 const nsRect intersectionRectRelativeToContainer =
394 nsLayoutUtils::TransformFrameRectToAncestor(
395 target, intersectionRect.value(), containerFrame);
396 const nsRect clipRect = OverflowAreas::GetOverflowClipRect(
397 intersectionRectRelativeToContainer,
398 containerFrame->GetRectRelativeToSelf(), clipAxes,
399 containerFrame->OverflowClipMargin(clipAxes));
400 intersectionRect =
401 intersectionRectRelativeToContainer.EdgeInclusiveIntersection(
402 clipRect);
403 if (!intersectionRect) {
404 return Nothing();
405 }
406 target = containerFrame;
407 }
408 }
409 containerFrame =
410 nsLayoutUtils::GetCrossDocParentFrameInProcess(containerFrame);
411 }
412 MOZ_ASSERT(intersectionRect)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(intersectionRect)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(intersectionRect))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("intersectionRect"
, "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 412); AnnotateMozCrashReason("MOZ_ASSERT" "(" "intersectionRect"
")"); do { *((volatile int*)__null) = 412; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
413
414 // 4. Map intersectionRect to the coordinate space of the intersection root.
415 nsRect intersectionRectRelativeToRoot =
416 nsLayoutUtils::TransformFrameRectToAncestor(
417 target, intersectionRect.value(),
418 nsLayoutUtils::GetContainingBlockForClientRect(aRoot));
419
420 // 5.Update intersectionRect by intersecting it with the root intersection
421 // rectangle.
422 intersectionRect =
423 intersectionRectRelativeToRoot.EdgeInclusiveIntersection(aRootBounds);
424 if (intersectionRect.isNothing()) {
425 return Nothing();
426 }
427 // 6. Map intersectionRect to the coordinate space of the viewport of the
428 // Document containing the target.
429 //
430 // FIXME(emilio): I think this may not be correct if the root is explicit
431 // and in the same document, since then the rectangle may not be relative to
432 // the viewport already (but it's in the same document).
433 nsRect rect = intersectionRect.value();
434 if (aTarget->PresContext() != aRoot->PresContext()) {
435 if (nsIFrame* rootScrollContainerFrame =
436 aTarget->PresShell()->GetRootScrollContainerFrame()) {
437 nsLayoutUtils::TransformRect(aRoot, rootScrollContainerFrame, rect);
438 }
439 }
440
441 // In out-of-process iframes we need to take an intersection with the remote
442 // document visible rect which was already clipped by ancestor document's
443 // viewports.
444 if (aRemoteDocumentVisibleRect) {
445 MOZ_ASSERT(aRoot->PresContext()->IsRootContentDocumentInProcess() &&do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aRoot->PresContext()->IsRootContentDocumentInProcess
() && !aRoot->PresContext()->IsRootContentDocumentCrossProcess
())>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(aRoot->PresContext()->IsRootContentDocumentInProcess
() && !aRoot->PresContext()->IsRootContentDocumentCrossProcess
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("aRoot->PresContext()->IsRootContentDocumentInProcess() && !aRoot->PresContext()->IsRootContentDocumentCrossProcess()"
, "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 446); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aRoot->PresContext()->IsRootContentDocumentInProcess() && !aRoot->PresContext()->IsRootContentDocumentCrossProcess()"
")"); do { *((volatile int*)__null) = 446; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
446 !aRoot->PresContext()->IsRootContentDocumentCrossProcess())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aRoot->PresContext()->IsRootContentDocumentInProcess
() && !aRoot->PresContext()->IsRootContentDocumentCrossProcess
())>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(aRoot->PresContext()->IsRootContentDocumentInProcess
() && !aRoot->PresContext()->IsRootContentDocumentCrossProcess
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("aRoot->PresContext()->IsRootContentDocumentInProcess() && !aRoot->PresContext()->IsRootContentDocumentCrossProcess()"
, "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 446); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aRoot->PresContext()->IsRootContentDocumentInProcess() && !aRoot->PresContext()->IsRootContentDocumentCrossProcess()"
")"); do { *((volatile int*)__null) = 446; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
447
448 intersectionRect =
449 rect.EdgeInclusiveIntersection(*aRemoteDocumentVisibleRect);
450 if (intersectionRect.isNothing()) {
451 return Nothing();
452 }
453 rect = intersectionRect.value();
454 }
455
456 return Some(rect);
457}
458
459struct OopIframeMetrics {
460 nsIFrame* mInProcessRootFrame = nullptr;
461 nsRect mInProcessRootRect;
462 nsRect mRemoteDocumentVisibleRect;
463};
464
465static Maybe<OopIframeMetrics> GetOopIframeMetrics(
466 const Document& aDocument, const Document* aRootDocument) {
467 const Document* rootDoc =
468 nsContentUtils::GetInProcessSubtreeRootDocument(&aDocument);
469 MOZ_ASSERT(rootDoc)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(rootDoc)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(rootDoc))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("rootDoc", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 469); AnnotateMozCrashReason("MOZ_ASSERT" "(" "rootDoc" ")"
); do { *((volatile int*)__null) = 469; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
470
471 if (rootDoc->IsTopLevelContentDocument()) {
472 return Nothing();
473 }
474
475 if (aRootDocument &&
476 rootDoc ==
477 nsContentUtils::GetInProcessSubtreeRootDocument(aRootDocument)) {
478 // aRootDoc, if non-null, is either the implicit root
479 // (top-level-content-document) or a same-origin document passed explicitly.
480 //
481 // In the former case, we should've returned above if there are no iframes
482 // in between. This condition handles the explicit, same-origin root
483 // document, when both are embedded in an OOP iframe.
484 return Nothing();
485 }
486
487 PresShell* rootPresShell = rootDoc->GetPresShell();
488 if (!rootPresShell || rootPresShell->IsDestroying()) {
489 return Some(OopIframeMetrics{});
490 }
491
492 nsIFrame* inProcessRootFrame = rootPresShell->GetRootFrame();
493 if (!inProcessRootFrame) {
494 return Some(OopIframeMetrics{});
495 }
496
497 BrowserChild* browserChild = BrowserChild::GetFrom(rootDoc->GetDocShell());
498 if (!browserChild) {
499 return Some(OopIframeMetrics{});
500 }
501
502 if (MOZ_UNLIKELY(NS_WARN_IF(browserChild->IsTopLevel()))(__builtin_expect(!!(NS_warn_if_impl(browserChild->IsTopLevel
(), "browserChild->IsTopLevel()", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 502)), 0))
) {
503 // FIXME(bug 1772083): This can be hit with popups, e.g. in
504 // html/browsers/the-window-object/open-close/no_window_open_when_term_nesting_level_nonzero.window.html
505 // temporarily while opening a new popup (on the about:blank doc).
506 // MOZ_ASSERT_UNREACHABLE("Top level BrowserChild but non-top level doc?");
507 return Nothing();
508 }
509
510 nsRect inProcessRootRect;
511 if (ScrollContainerFrame* rootScrollContainerFrame =
512 rootPresShell->GetRootScrollContainerFrame()) {
513 inProcessRootRect = rootScrollContainerFrame
514 ->GetScrollPortRectAccountingForDynamicToolbar();
515 }
516
517 Maybe<LayoutDeviceRect> remoteDocumentVisibleRect =
518 browserChild->GetTopLevelViewportVisibleRectInSelfCoords();
519 if (!remoteDocumentVisibleRect) {
520 return Some(OopIframeMetrics{});
521 }
522
523 return Some(OopIframeMetrics{
524 inProcessRootFrame,
525 inProcessRootRect,
526 LayoutDeviceRect::ToAppUnits(
527 *remoteDocumentVisibleRect,
528 rootPresShell->GetPresContext()->AppUnitsPerDevPixel()),
529 });
530}
531
532// https://w3c.github.io/IntersectionObserver/#update-intersection-observations-algo
533// step 2.1
534IntersectionInput DOMIntersectionObserver::ComputeInput(
535 const Document& aDocument, const nsINode* aRoot,
536 const StyleRect<LengthPercentage>* aRootMargin) {
537 // 1 - Let rootBounds be observer's root intersection rectangle.
538 // ... but since the intersection rectangle depends on the target, we defer
539 // the inflation until later.
540 // NOTE: |rootRect| and |rootFrame| will be root in the same process. In
541 // out-of-process iframes, they are NOT root ones of the top level content
542 // document.
543 nsRect rootRect;
544 nsIFrame* rootFrame = nullptr;
545 const nsINode* root = aRoot;
546 const bool isImplicitRoot = !aRoot;
547 Maybe<nsRect> remoteDocumentVisibleRect;
548 if (aRoot && aRoot->IsElement()) {
549 if ((rootFrame = aRoot->AsElement()->GetPrimaryFrame())) {
550 nsRect rootRectRelativeToRootFrame;
551 if (ScrollContainerFrame* scrollContainerFrame =
552 do_QueryFrame(rootFrame)) {
553 // rootRectRelativeToRootFrame should be the content rect of rootFrame,
554 // not including the scrollbars.
555 rootRectRelativeToRootFrame =
556 scrollContainerFrame
557 ->GetScrollPortRectAccountingForDynamicToolbar();
558 } else {
559 // rootRectRelativeToRootFrame should be the border rect of rootFrame.
560 rootRectRelativeToRootFrame = rootFrame->GetRectRelativeToSelf();
561 }
562 nsIFrame* containingBlock =
563 nsLayoutUtils::GetContainingBlockForClientRect(rootFrame);
564 rootRect = nsLayoutUtils::TransformFrameRectToAncestor(
565 rootFrame, rootRectRelativeToRootFrame, containingBlock);
566 }
567 } else {
568 MOZ_ASSERT(!aRoot || aRoot->IsDocument())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!aRoot || aRoot->IsDocument())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(!aRoot || aRoot->IsDocument
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("!aRoot || aRoot->IsDocument()", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 568); AnnotateMozCrashReason("MOZ_ASSERT" "(" "!aRoot || aRoot->IsDocument()"
")"); do { *((volatile int*)__null) = 568; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
569 const Document* rootDocument =
570 aRoot ? aRoot->AsDocument()
571 : GetTopLevelContentDocumentInThisProcess(aDocument);
572 root = rootDocument;
573
574 if (rootDocument) {
575 // We're in the same process as the root document, though note that there
576 // could be an out-of-process iframe in between us and the root. Grab the
577 // root frame and the root rect.
578 //
579 // Note that the root rect is always good (we assume no DPI changes in
580 // between the two documents, and we don't need to convert coordinates).
581 //
582 // The root frame however we may need to tweak in the block below, if
583 // there's any OOP iframe in between `rootDocument` and `aDocument`, to
584 // handle the OOP iframe positions.
585 if (PresShell* presShell = rootDocument->GetPresShell()) {
586 rootFrame = presShell->GetRootFrame();
587 // We use the root scroll container frame's scroll port to account the
588 // scrollbars in rootRect, if needed.
589 if (ScrollContainerFrame* rootScrollContainerFrame =
590 presShell->GetRootScrollContainerFrame()) {
591 rootRect = rootScrollContainerFrame
592 ->GetScrollPortRectAccountingForDynamicToolbar();
593 } else if (rootFrame) {
594 rootRect = rootFrame->GetRectRelativeToSelf();
595 }
596 }
597 }
598
599 if (Maybe<OopIframeMetrics> metrics =
600 GetOopIframeMetrics(aDocument, rootDocument)) {
601 rootFrame = metrics->mInProcessRootFrame;
602 if (!rootDocument) {
603 rootRect = metrics->mInProcessRootRect;
604 }
605 remoteDocumentVisibleRect = Some(metrics->mRemoteDocumentVisibleRect);
606 }
607 }
608
609 nsMargin rootMargin; // This root margin is NOT applied in `implicit root`
610 // case, e.g. in out-of-process iframes.
611 if (aRootMargin) {
612 for (const auto side : mozilla::AllPhysicalSides()) {
613 nscoord basis = side == eSideTop || side == eSideBottom
614 ? rootRect.Height()
615 : rootRect.Width();
616 rootMargin.Side(side) = aRootMargin->Get(side).Resolve(
617 basis, static_cast<nscoord (*)(float)>(NSToCoordRoundWithClamp));
618 }
619 }
620 return {isImplicitRoot, root, rootFrame,
621 rootRect, rootMargin, remoteDocumentVisibleRect};
622}
623
624// https://w3c.github.io/IntersectionObserver/#update-intersection-observations-algo
625// (steps 2.1 - 2.5)
626IntersectionOutput DOMIntersectionObserver::Intersect(
627 const IntersectionInput& aInput, const Element& aTarget, BoxToUse aBoxToUse,
628 IsForProximityToViewport aIsForProximityToViewport) {
629 const bool isSimilarOrigin = SimilarOrigin(aTarget, aInput.mRootNode) ==
630 BrowsingContextOrigin::Similar;
631 nsIFrame* targetFrame = aTarget.GetPrimaryFrame();
632 if (!targetFrame || !aInput.mRootFrame) {
633 return {isSimilarOrigin};
634 }
635
636 // "From the perspective of an IntersectionObserver, the skipped contents
637 // of an element are never intersecting the intersection root. This is
638 // true even if both the root and the target elements are in the skipped
639 // contents."
640 // https://drafts.csswg.org/css-contain/#cv-notes
641 //
642 // Skip the intersection if the element is hidden, unless this is the
643 // specifically to determine the proximity to the viewport for
644 // `content-visibility: auto` elements.
645 if (aIsForProximityToViewport == IsForProximityToViewport::No &&
646 targetFrame->IsHiddenByContentVisibilityOnAnyAncestor()) {
647 return {isSimilarOrigin};
648 }
649
650 // 2.2. If the intersection root is not the implicit root, and target is
651 // not in the same Document as the intersection root, skip to step 11.
652 if (!aInput.mIsImplicitRoot &&
653 aInput.mRootNode->OwnerDoc() != aTarget.OwnerDoc()) {
654 return {isSimilarOrigin};
655 }
656
657 // 2.3. If the intersection root is an element and target is not a descendant
658 // of the intersection root in the containing block chain, skip to step 11.
659 //
660 // NOTE(emilio): We also do this if target is the implicit root, pending
661 // clarification in
662 // https://github.com/w3c/IntersectionObserver/issues/456.
663 if (aInput.mRootFrame == targetFrame ||
664 !nsLayoutUtils::IsAncestorFrameCrossDocInProcess(aInput.mRootFrame,
665 targetFrame)) {
666 return {isSimilarOrigin};
667 }
668
669 nsRect rootBounds = aInput.mRootRect;
670 if (isSimilarOrigin) {
671 rootBounds.Inflate(aInput.mRootMargin);
672 }
673
674 // 2.4. Set targetRect to the DOMRectReadOnly obtained by running the
675 // getBoundingClientRect() algorithm on target. We compute the box relative to
676 // self first, then transform.
677 nsLayoutUtils::GetAllInFlowRectsFlags flags{
678 nsLayoutUtils::GetAllInFlowRectsFlag::AccountForTransforms};
679 if (aBoxToUse == BoxToUse::Content) {
680 flags += nsLayoutUtils::GetAllInFlowRectsFlag::UseContentBox;
681 }
682 nsRect targetRectRelativeToTarget =
683 nsLayoutUtils::GetAllInFlowRectsUnion(targetFrame, targetFrame, flags);
684
685 if (aBoxToUse == BoxToUse::OverflowClip) {
686 const auto& disp = *targetFrame->StyleDisplay();
687 auto clipAxes = targetFrame->ShouldApplyOverflowClipping(&disp);
688 if (!clipAxes.isEmpty()) {
689 targetRectRelativeToTarget = OverflowAreas::GetOverflowClipRect(
690 targetRectRelativeToTarget, targetRectRelativeToTarget, clipAxes,
691 targetFrame->OverflowClipMargin(clipAxes));
692 }
693 }
694
695 auto targetRect = nsLayoutUtils::TransformFrameRectToAncestor(
696 targetFrame, targetRectRelativeToTarget,
697 nsLayoutUtils::GetContainingBlockForClientRect(targetFrame));
698
699 // For content-visibility, we need to observe the overflow clip edge,
700 // https://drafts.csswg.org/css-contain-2/#close-to-the-viewport
701 MOZ_ASSERT_IF(aIsForProximityToViewport == IsForProximityToViewport::Yes,do { if (aIsForProximityToViewport == IsForProximityToViewport
::Yes) { do { static_assert( mozilla::detail::AssertionConditionType
<decltype(aBoxToUse == BoxToUse::OverflowClip)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(aBoxToUse == BoxToUse::OverflowClip))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("aBoxToUse == BoxToUse::OverflowClip"
, "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 702); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aBoxToUse == BoxToUse::OverflowClip"
")"); do { *((volatile int*)__null) = 702; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false); } } while (
false)
702 aBoxToUse == BoxToUse::OverflowClip)do { if (aIsForProximityToViewport == IsForProximityToViewport
::Yes) { do { static_assert( mozilla::detail::AssertionConditionType
<decltype(aBoxToUse == BoxToUse::OverflowClip)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(aBoxToUse == BoxToUse::OverflowClip))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("aBoxToUse == BoxToUse::OverflowClip"
, "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 702); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aBoxToUse == BoxToUse::OverflowClip"
")"); do { *((volatile int*)__null) = 702; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false); } } while (
false)
;
703
704 // 2.5. Let intersectionRect be the result of running the compute the
705 // intersection algorithm on target and observer’s intersection root.
706 Maybe<nsRect> intersectionRect = ComputeTheIntersection(
707 targetFrame, targetRectRelativeToTarget, aInput.mRootFrame, rootBounds,
708 aInput.mRemoteDocumentVisibleRect, aIsForProximityToViewport);
709
710 return {isSimilarOrigin, rootBounds, targetRect, intersectionRect};
711}
712
713IntersectionOutput DOMIntersectionObserver::Intersect(
714 const IntersectionInput& aInput, const nsRect& aTargetRect) {
715 nsRect rootBounds = aInput.mRootRect;
716 rootBounds.Inflate(aInput.mRootMargin);
717 auto intersectionRect =
718 aInput.mRootRect.EdgeInclusiveIntersection(aTargetRect);
719 if (intersectionRect && aInput.mRemoteDocumentVisibleRect) {
720 intersectionRect = intersectionRect->EdgeInclusiveIntersection(
721 *aInput.mRemoteDocumentVisibleRect);
722 }
723 return {true, rootBounds, aTargetRect, intersectionRect};
724}
725
726// https://w3c.github.io/IntersectionObserver/#update-intersection-observations-algo
727// (step 2)
728void DOMIntersectionObserver::Update(Document& aDocument,
729 DOMHighResTimeStamp time) {
730 auto input = ComputeInput(aDocument, mRoot, &mRootMargin);
731
732 // 2. For each target in observer’s internal [[ObservationTargets]] slot,
733 // processed in the same order that observe() was called on each target:
734 for (Element* target : mObservationTargets) {
735 // 2.1 - 2.4.
736 IntersectionOutput output = Intersect(input, *target);
737
738 // 2.5. Let targetArea be targetRect’s area.
739 int64_t targetArea = (int64_t)output.mTargetRect.Width() *
740 (int64_t)output.mTargetRect.Height();
741
742 // 2.6. Let intersectionArea be intersectionRect’s area.
743 int64_t intersectionArea =
744 !output.mIntersectionRect
745 ? 0
746 : (int64_t)output.mIntersectionRect->Width() *
747 (int64_t)output.mIntersectionRect->Height();
748
749 // 2.7. Let isIntersecting be true if targetRect and rootBounds intersect or
750 // are edge-adjacent, even if the intersection has zero area (because
751 // rootBounds or targetRect have zero area); otherwise, let isIntersecting
752 // be false.
753 const bool isIntersecting = output.Intersects();
754
755 // 2.8. If targetArea is non-zero, let intersectionRatio be intersectionArea
756 // divided by targetArea. Otherwise, let intersectionRatio be 1 if
757 // isIntersecting is true, or 0 if isIntersecting is false.
758 double intersectionRatio;
759 if (targetArea > 0.0) {
760 intersectionRatio =
761 std::min((double)intersectionArea / (double)targetArea, 1.0);
762 } else {
763 intersectionRatio = isIntersecting ? 1.0 : 0.0;
764 }
765
766 // 2.9 Let thresholdIndex be the index of the first entry in
767 // observer.thresholds whose value is greater than intersectionRatio, or the
768 // length of observer.thresholds if intersectionRatio is greater than or
769 // equal to the last entry in observer.thresholds.
770 int32_t thresholdIndex = -1;
771
772 // If not intersecting, we can just shortcut, as we know that the thresholds
773 // are always between 0 and 1.
774 if (isIntersecting) {
775 thresholdIndex = mThresholds.IndexOfFirstElementGt(intersectionRatio);
776 if (thresholdIndex == 0) {
777 // Per the spec, we should leave threshold at 0 and distinguish between
778 // "less than all thresholds and intersecting" and "not intersecting"
779 // (queuing observer entries as both cases come to pass). However,
780 // neither Chrome nor the WPT tests expect this behavior, so treat these
781 // two cases as one.
782 //
783 // See https://github.com/w3c/IntersectionObserver/issues/432 about
784 // this.
785 thresholdIndex = -1;
786 }
787 }
788
789 // Steps 2.10 - 2.15.
790 bool updated = false;
791 if (auto entry = mObservationTargetMap.Lookup(target)) {
792 updated = entry.Data() != thresholdIndex;
793 entry.Data() = thresholdIndex;
794 } else {
795 MOZ_ASSERT_UNREACHABLE("Target not properly registered?")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(false)>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (
false); MOZ_ReportAssertionFailure("false" " (" "MOZ_ASSERT_UNREACHABLE: "
"Target not properly registered?" ")", "/var/lib/jenkins/workspace/firefox-scan-build/dom/base/DOMIntersectionObserver.cpp"
, 795); AnnotateMozCrashReason("MOZ_ASSERT" "(" "false" ") ("
"MOZ_ASSERT_UNREACHABLE: " "Target not properly registered?"
")"); do { *((volatile int*)__null) = 795; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
796 }
797
798 if (updated) {
799 // See https://github.com/w3c/IntersectionObserver/issues/432 about
800 // why we use thresholdIndex > 0 rather than isIntersecting for the
801 // entry's isIntersecting value.
802 QueueIntersectionObserverEntry(
803 target, time,
804 output.mIsSimilarOrigin ? Some(output.mRootBounds) : Nothing(),
805 output.mTargetRect, output.mIntersectionRect, thresholdIndex > 0,
806 intersectionRatio);
807 }
808 }
809}
810
811void DOMIntersectionObserver::QueueIntersectionObserverEntry(
812 Element* aTarget, DOMHighResTimeStamp time, const Maybe<nsRect>& aRootRect,
813 const nsRect& aTargetRect, const Maybe<nsRect>& aIntersectionRect,
814 bool aIsIntersecting, double aIntersectionRatio) {
815 RefPtr<DOMRect> rootBounds;
816 if (aRootRect.isSome()) {
817 rootBounds = new DOMRect(mOwner);
818 rootBounds->SetLayoutRect(aRootRect.value());
819 }
820 RefPtr<DOMRect> boundingClientRect = new DOMRect(mOwner);
821 boundingClientRect->SetLayoutRect(aTargetRect);
822 RefPtr<DOMRect> intersectionRect = new DOMRect(mOwner);
823 if (aIntersectionRect.isSome()) {
824 intersectionRect->SetLayoutRect(aIntersectionRect.value());
825 }
826 RefPtr<DOMIntersectionObserverEntry> entry = new DOMIntersectionObserverEntry(
827 mOwner, time, rootBounds.forget(), boundingClientRect.forget(),
828 intersectionRect.forget(), aIsIntersecting, aTarget, aIntersectionRatio);
829 mQueuedEntries.AppendElement(entry.forget());
830}
831
832void DOMIntersectionObserver::Notify() {
833 if (!mQueuedEntries.Length()) {
834 return;
835 }
836 Sequence<OwningNonNull<DOMIntersectionObserverEntry>> entries;
837 if (entries.SetCapacity(mQueuedEntries.Length(), mozilla::fallible)) {
838 for (size_t i = 0; i < mQueuedEntries.Length(); ++i) {
839 RefPtr<DOMIntersectionObserverEntry> next = mQueuedEntries[i];
840 *entries.AppendElement(mozilla::fallible) = next;
841 }
842 }
843 mQueuedEntries.Clear();
844
845 if (mCallback.is<RefPtr<dom::IntersectionCallback>>()) {
846 RefPtr<dom::IntersectionCallback> callback(
847 mCallback.as<RefPtr<dom::IntersectionCallback>>());
848 callback->Call(this, entries, *this);
849 } else {
850 mCallback.as<NativeCallback>()(entries);
851 }
852}
853
854} // namespace mozilla::dom

/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5// See the comment in ServoBindings.h about the same.
6#pragma GCC diagnostic push
7#ifdef __clang__1
8# pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
9#endif
10
11#ifndef mozilla_ServoStyleConsts_h
12#define mozilla_ServoStyleConsts_h
13
14
15/* Generated with cbindgen:0.26.0 */
16
17/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen. See RunCbindgen.py
18 * To modify this file, edit servo/ports/geckolib/cbindgen.toml and build Firefox.
19 */
20
21
22#include <cstdarg>
23#include <cstdint>
24#include <cstdlib>
25#include <ostream>
26#include <new>
27#include "mozilla/ServoStyleConstsForwards.h"
28#include "mozilla/ServoStyleSet.h"
29// Work-around silly windows.h define.
30#pragma push_macro("STRICT")
31#undef STRICT
32#pragma push_macro("TRANSPARENT")
33#undef TRANSPARENT
34
35
36namespace mozilla {
37
38#if defined(CBINDGEN_IS_GECKO)
39/// The minimum stack size for a thread in the styling pool, in kilobytes.
40constexpr static const uintptr_t StyleSTYLE_THREAD_STACK_SIZE_KB = 256;
41#endif
42
43#if defined(CBINDGEN_IS_SERVO)
44/// The minimum stack size for a thread in the styling pool, in kilobytes.
45/// Servo requires a bigger stack in debug builds.
46constexpr static const uintptr_t StyleSTYLE_THREAD_STACK_SIZE_KB = 512;
47#endif
48
49/// The stack margin. If we get this deep in the stack, we will skip recursive
50/// optimizations to ensure that there is sufficient room for non-recursive work.
51///
52/// We allocate large safety margins because certain OS calls can use very large
53/// amounts of stack space [1]. Reserving a larger-than-necessary stack costs us
54/// address space, but if we keep our safety margin big, we will generally avoid
55/// committing those extra pages, and only use them in edge cases that would
56/// otherwise cause crashes.
57///
58/// When measured with 128KB stacks and 40KB margin, we could support 53
59/// levels of recursion before the limiter kicks in, on x86_64-Linux [2]. When
60/// we doubled the stack size, we added it all to the safety margin, so we should
61/// be able to get the same amount of recursion.
62///
63/// [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1395708#c15
64/// [2] See Gecko bug 1376883 for more discussion on the measurements.
65constexpr static const uintptr_t StyleSTACK_SAFETY_MARGIN_KB = 168;
66
67/// The amount of nodes that the style sharing candidate cache should hold at
68/// most.
69///
70/// The cache size was chosen by measuring style sharing and resulting
71/// performance on a few pages; sizes up to about 32 were giving good sharing
72/// improvements (e.g. 3x fewer styles having to be resolved than at size 8) and
73/// slight performance improvements. Sizes larger than 32 haven't really been
74/// tested.
75constexpr static const uintptr_t StyleSHARING_CACHE_SIZE = 32;
76
77/// We use an unsigned 10.6 fixed-point value (range 0.0 - 1023.984375).
78constexpr static const uint16_t StyleZOOM_FRACTION_BITS = 6;
79
80/// font-weight: range 1..1000, fractional values permitted; keywords
81/// 'normal', 'bold' aliased to 400, 700 respectively.
82///
83/// We use an unsigned 10.6 fixed-point value (range 0.0 - 1023.984375)
84constexpr static const uint16_t StyleFONT_WEIGHT_FRACTION_BITS = 6;
85
86/// - Use a signed 8.8 fixed-point value (representable range -128.0..128)
87///
88/// Values of <angle> below -90 or above 90 not permitted, so we use out of
89/// range values to represent normal | oblique
90constexpr static const uint16_t StyleFONT_STYLE_FRACTION_BITS = 8;
91
92/// font-stretch is a percentage relative to normal.
93///
94/// We use an unsigned 10.6 fixed-point value (range 0.0 - 1023.984375)
95///
96/// We arbitrarily limit here to 1000%. (If that becomes a problem, we could
97/// reduce the number of fractional bits and increase the limit.)
98constexpr static const uint16_t StyleFONT_STRETCH_FRACTION_BITS = 6;
99
100constexpr static const uint8_t StyleLengthPercentageUnion_TAG_CALC = 0;
101
102constexpr static const uint8_t StyleLengthPercentageUnion_TAG_LENGTH = 1;
103
104constexpr static const uint8_t StyleLengthPercentageUnion_TAG_PERCENTAGE = 2;
105
106constexpr static const uint8_t StyleLengthPercentageUnion_TAG_MASK = 3;
107
108/// These are the limits that we choose to clamp grid line numbers to.
109/// http://drafts.csswg.org/css-grid/#overlarge-grids
110/// line_num is clamped to this range at parse time.
111constexpr static const int32_t StyleMIN_GRID_LINE = -10000;
112
113/// See above.
114constexpr static const int32_t StyleMAX_GRID_LINE = 10000;
115
116/// The minimum font-weight value per:
117///
118/// https://drafts.csswg.org/css-fonts-4/#font-weight-numeric-values
119constexpr static const float StyleMIN_FONT_WEIGHT = 1.;
120
121/// The maximum font-weight value per:
122///
123/// https://drafts.csswg.org/css-fonts-4/#font-weight-numeric-values
124constexpr static const float StyleMAX_FONT_WEIGHT = 1000.;
125
126/// From https://drafts.csswg.org/css-fonts-4/#valdef-font-style-oblique-angle:
127///
128/// Values less than -90deg or values greater than 90deg are
129/// invalid and are treated as parse errors.
130///
131/// The maximum angle value that `font-style: oblique` should compute to.
132constexpr static const float StyleFONT_STYLE_OBLIQUE_MAX_ANGLE_DEGREES = 90.;
133
134/// The minimum angle value that `font-style: oblique` should compute to.
135constexpr static const float StyleFONT_STYLE_OBLIQUE_MIN_ANGLE_DEGREES = -90.;
136
137/// The default font size.
138constexpr static const float StyleFONT_MEDIUM_PX = 16.0;
139
140/// The default line height.
141constexpr static const float StyleFONT_MEDIUM_LINE_HEIGHT_PX = (StyleFONT_MEDIUM_PX * 1.2);
142
143/// Number of non-normal components
144constexpr static const uint8_t StylePAINT_ORDER_COUNT = 3;
145
146/// Number of bits for each component
147constexpr static const uint8_t StylePAINT_ORDER_SHIFT = 2;
148
149/// Mask with above bits set
150constexpr static const uint8_t StylePAINT_ORDER_MASK = 3;
151
152
153
154#if defined(CBINDGEN_IS_SERVO)
155/// The number of eager pseudo-elements. Keep this in sync with cascade_type.
156constexpr static const uintptr_t StyleEAGER_PSEUDO_COUNT = 3;
157#endif
158
159/// Whether @import rules are allowed.
160enum class StyleAllowImportRules : uint8_t {
161 /// @import rules will be parsed.
162 Yes,
163 /// @import rules will not be parsed.
164 No,
165};
166
167/// Whether to allow negative lengths or not.
168enum class StyleAllowedNumericType : uint8_t {
169 /// Allow all kind of numeric values.
170 All,
171 /// Allow only non-negative numeric values.
172 NonNegative,
173 /// Allow only numeric values greater or equal to 1.0.
174 AtLeastOne,
175 /// Allow only numeric values from 0 to 1.0.
176 ZeroToOne,
177};
178
179/// Keyword values for the anchor positioning function.
180enum class StyleAnchorSideKeyword : uint8_t {
181 /// Inside relative (i.e. Same side) to the inset property it's used in.
182 Inside,
183 /// Same as above, but outside (i.e. Opposite side).
184 Outside,
185 /// Top of the anchor element.
186 Top,
187 /// Left of the anchor element.
188 Left,
189 /// Right of the anchor element.
190 Right,
191 /// Bottom of the anchor element.
192 Bottom,
193 /// Refers to the start side of the anchor element for the same axis of the inset
194 /// property it's used in, resolved against the positioned element's containing
195 /// block's writing mode.
196 Start,
197 /// Same as above, but for the end side.
198 End,
199 /// Same as `start`, resolved against the positioned element's writing mode.
200 SelfStart,
201 /// Same as above, but for the end side.
202 SelfEnd,
203 /// Halfway between `start` and `end` sides.
204 Center,
205};
206
207/// Keyword values for the anchor size function.
208enum class StyleAnchorSizeKeyword : uint8_t {
209 /// Magic value for nothing.
210 None,
211 /// Width of the anchor element.
212 Width,
213 /// Height of the anchor element.
214 Height,
215 /// Block size of the anchor element.
216 Block,
217 /// Inline size of the anchor element.
218 Inline,
219 /// Same as `Block`, resolved against the positioned element's writing mode.
220 SelfBlock,
221 /// Same as `Inline`, resolved against the positioned element's writing mode.
222 SelfInline,
223};
224
225/// https://drafts.csswg.org/css-animations-2/#animation-composition
226enum class StyleAnimationComposition : uint8_t {
227 Replace,
228 Add,
229 Accumulate,
230};
231
232/// https://drafts.csswg.org/css-animations/#propdef-animation-direction
233enum class StyleAnimationDirection : uint8_t {
234 Normal,
235 Reverse,
236 Alternate,
237 AlternateReverse,
238};
239
240/// https://drafts.csswg.org/css-animations/#propdef-animation-fill-mode
241enum class StyleAnimationFillMode : uint8_t {
242 None,
243 Forwards,
244 Backwards,
245 Both,
246};
247
248/// https://drafts.csswg.org/css-animations/#animation-play-state
249enum class StyleAnimationPlayState : uint8_t {
250 Running,
251 Paused,
252};
253
254/// The value for the `appearance` property.
255///
256/// https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance
257enum class StyleAppearance : uint8_t {
258 /// No appearance at all.
259 None,
260 /// Default appearance for the element.
261 ///
262 /// This value doesn't make sense for -moz-default-appearance, but we don't bother to guard
263 /// against parsing it.
264 Auto,
265 /// A searchfield.
266 Searchfield,
267 /// A multi-line text field, e.g. HTML <textarea>.
268 Textarea,
269 /// A checkbox element.
270 Checkbox,
271 /// A radio element within a radio group.
272 Radio,
273 /// A dropdown list.
274 Menulist,
275 /// List boxes.
276 Listbox,
277 /// A horizontal meter bar.
278 Meter,
279 /// A horizontal progress bar.
280 ProgressBar,
281 /// A typical dialog button.
282 Button,
283 /// A single-line text field, e.g. HTML <input type=text>.
284 Textfield,
285 /// The dropdown button(s) that open up a dropdown list.
286 MenulistButton,
287 /// Various arrows that go in buttons
288 ButtonArrowDown,
289 ButtonArrowNext,
290 ButtonArrowPrevious,
291 ButtonArrowUp,
292 /// A dual toolbar button (e.g., a Back button with a dropdown)
293 Dualbutton,
294 /// Menu Popup background.
295 Menupopup,
296 /// The meter bar's meter indicator.
297 Meterchunk,
298 /// The "arrowed" part of the dropdown button that open up a dropdown list.
299 MozMenulistArrowButton,
300 /// For HTML's <input type=number>
301 NumberInput,
302 /// For HTML's <input type=password>
303 PasswordInput,
304 /// The progress bar's progress indicator
305 Progresschunk,
306 /// nsRangeFrame and its subparts
307 Range,
308 RangeThumb,
309 /// The scrollbar slider
310 ScrollbarHorizontal,
311 ScrollbarVertical,
312 /// A scrollbar button (up/down/left/right).
313 /// Keep these in order (some code casts these values to `int` in order to
314 /// compare them against each other).
315 ScrollbarbuttonUp,
316 ScrollbarbuttonDown,
317 ScrollbarbuttonLeft,
318 ScrollbarbuttonRight,
319 /// The scrollbar thumb.
320 ScrollbarthumbHorizontal,
321 ScrollbarthumbVertical,
322 /// The scroll corner
323 Scrollcorner,
324 /// A separator. Can be horizontal or vertical.
325 Separator,
326 /// A spin control (up/down control for time/date pickers).
327 Spinner,
328 /// The up button of a spin control.
329 SpinnerUpbutton,
330 /// The down button of a spin control.
331 SpinnerDownbutton,
332 /// The textfield of a spin control
333 SpinnerTextfield,
334 /// A splitter. Can be horizontal or vertical.
335 Splitter,
336 /// A status bar in a main application window.
337 Statusbar,
338 /// A single tab in a tab widget.
339 Tab,
340 /// A single pane (inside the tabpanels container).
341 Tabpanel,
342 /// The tab panels container.
343 Tabpanels,
344 /// The tabs scroll arrows (left/right).
345 TabScrollArrowBack,
346 TabScrollArrowForward,
347 /// A single toolbar button (with no associated dropdown).
348 Toolbarbutton,
349 /// The dropdown portion of a toolbar button
350 ToolbarbuttonDropdown,
351 /// A tooltip.
352 Tooltip,
353 /// Sidebar appearance.
354 MozSidebar,
355 /// Mac help button.
356 MozMacHelpButton,
357 /// An appearance value for the root, so that we can get tinting and unified toolbar looks
358 /// (which require a transparent gecko background) without really using the whole transparency
359 /// set-up which otherwise loses window borders, see bug 1870481.
360 MozMacWindow,
361 /// Windows themed window frame elements.
362 MozWindowButtonBox,
363 MozWindowButtonClose,
364 MozWindowButtonMaximize,
365 MozWindowButtonMinimize,
366 MozWindowButtonRestore,
367 MozWindowTitlebar,
368 MozWindowTitlebarMaximized,
369 MozWindowDecorations,
370 MozMacDisclosureButtonClosed,
371 MozMacDisclosureButtonOpen,
372 /// A themed focus outline (for outline:auto).
373 ///
374 /// This isn't exposed to CSS at all, just here for convenience.
375 FocusOutline,
376 /// A dummy variant that should be last to let the GTK widget do hackery.
377 Count,
378};
379
380/// This indicates that the larger or smaller, respectively, of the two possible arcs must be
381/// chosen.
382/// https://drafts.csswg.org/css-shapes-2/#typedef-shape-arc-size
383enum class StyleArcSize : uint8_t {
384 /// Choose the small one. The default value. (This also represents 0 in the svg path.)
385 Small = 0,
386 /// Choose the large one. (This also represents 1 in the svg path.)
387 Large = 1,
388};
389
390/// This indicates that the arc that is traced around the ellipse clockwise or counter-clockwise
391/// from the center.
392/// https://drafts.csswg.org/css-shapes-2/#typedef-shape-arc-sweep
393enum class StyleArcSweep : uint8_t {
394 /// Counter-clockwise. The default value. (This also represents 0 in the svg path.)
395 Ccw = 0,
396 /// Clockwise. (This also represents 1 in the svg path.)
397 Cw = 1,
398};
399
400/// A specified value for the `baseline-source` property.
401/// https://drafts.csswg.org/css-inline-3/#baseline-source
402enum class StyleBaselineSource : uint8_t {
403 /// `Last` for `inline-block`, `First` otherwise.
404 Auto,
405 /// Use first baseline for alignment.
406 First,
407 /// Use last baseline for alignment.
408 Last,
409};
410
411/// Before flag, defined as per https://drafts.csswg.org/css-easing/#before-flag
412/// This flag is never user-specified.
413enum class StyleEasingBeforeFlag : uint8_t {
414 Unset,
415 Set,
416};
417
418/// A single border-image-repeat keyword.
419enum class StyleBorderImageRepeatKeyword : uint8_t {
420 Stretch,
421 Repeat,
422 Round,
423 Space,
424};
425
426/// A specified value for a single side of a `border-style` property.
427///
428/// The order here corresponds to the integer values from the border conflict
429/// resolution rules in CSS 2.1 § 17.6.2.1. Higher values override lower values.
430enum class StyleBorderStyle : uint8_t {
431 Hidden,
432 None,
433 Inset,
434 Groove,
435 Outset,
436 Ridge,
437 Dotted,
438 Dashed,
439 Solid,
440 Double,
441};
442
443/// A kind of break between two boxes.
444///
445/// https://drafts.csswg.org/css-break/#break-between
446enum class StyleBreakBetween : uint8_t {
447 Always,
448 Auto,
449 Page,
450 Avoid,
451 Left,
452 Right,
453};
454
455/// A kind of break within a box.
456///
457/// https://drafts.csswg.org/css-break/#break-within
458enum class StyleBreakWithin : uint8_t {
459 Auto,
460 Avoid,
461 AvoidPage,
462 AvoidColumn,
463};
464
465/// This indicates the command is absolute or relative.
466/// https://drafts.csswg.org/css-shapes-2/#typedef-shape-by-to
467enum class StyleByTo : uint8_t {
468 /// This indicates that the <coordinate-pair>s are relative to the command’s starting point.
469 By,
470 /// This relative to the top-left corner of the reference box.
471 To,
472};
473
474/// Specified values for the `caption-side` property.
475///
476/// Note that despite having "physical" names, these are actually interpreted
477/// according to the table's writing-mode: Top and Bottom are treated as
478/// block-start and -end respectively.
479///
480/// https://drafts.csswg.org/css-tables/#propdef-caption-side
481enum class StyleCaptionSide : uint8_t {
482 Top,
483 Bottom,
484};
485
486/// Represents a channel keyword inside a color.
487enum class StyleChannelKeyword : uint8_t {
488 /// alpha
489 Alpha,
490 /// a
491 A,
492 /// b, blackness, blue
493 B,
494 /// chroma
495 C,
496 /// green
497 G,
498 /// hue
499 H,
500 /// lightness
501 L,
502 /// red
503 R,
504 /// saturation
505 S,
506 /// whiteness
507 W,
508 /// x
509 X,
510 /// y
511 Y,
512 /// z
513 Z,
514};
515
516/// https://drafts.csswg.org/css2/#propdef-clear
517enum class StyleClear : uint8_t {
518 None,
519 Left,
520 Right,
521 Both,
522 InlineStart,
523 InlineEnd,
524};
525
526#if defined(CBINDGEN_IS_GECKO)
527/// Values for the color-gamut media feature.
528/// This implements PartialOrd so that lower values will correctly match
529/// higher capabilities.
530enum class StyleColorGamut : uint8_t {
531#if defined(CBINDGEN_IS_GECKO)
532 /// The sRGB gamut.
533 Srgb,
534#endif
535#if defined(CBINDGEN_IS_GECKO)
536 /// The gamut specified by the Display P3 Color Space.
537 P3,
538#endif
539#if defined(CBINDGEN_IS_GECKO)
540 /// The gamut specified by the ITU-R Recommendation BT.2020 Color Space.
541 Rec2020,
542#endif
543};
544#endif
545
546/// A color space representation in the CSS specification.
547///
548/// https://drafts.csswg.org/css-color-4/#typedef-color-space
549enum class StyleColorSpace : uint8_t {
550 /// A color specified in the sRGB color space with either the rgb/rgba(..)
551 /// functions or the newer color(srgb ..) function. If the color(..)
552 /// function is used, the AS_COLOR_FUNCTION flag will be set. Examples:
553 /// "color(srgb 0.691 0.139 0.259)", "rgb(176, 35, 66)"
554 Srgb = 0,
555 /// A color specified in the Hsl notation in the sRGB color space, e.g.
556 /// "hsl(289.18 93.136% 65.531%)"
557 /// https://drafts.csswg.org/css-color-4/#the-hsl-notation
558 Hsl,
559 /// A color specified in the Hwb notation in the sRGB color space, e.g.
560 /// "hwb(740deg 20% 30%)"
561 /// https://drafts.csswg.org/css-color-4/#the-hwb-notation
562 Hwb,
563 /// A color specified in the Lab color format, e.g.
564 /// "lab(29.2345% 39.3825 20.0664)".
565 /// https://w3c.github.io/csswg-drafts/css-color-4/#lab-colors
566 Lab,
567 /// A color specified in the Lch color format, e.g.
568 /// "lch(29.2345% 44.2 27)".
569 /// https://w3c.github.io/csswg-drafts/css-color-4/#lch-colors
570 Lch,
571 /// A color specified in the Oklab color format, e.g.
572 /// "oklab(40.101% 0.1147 0.0453)".
573 /// https://w3c.github.io/csswg-drafts/css-color-4/#lab-colors
574 Oklab,
575 /// A color specified in the Oklch color format, e.g.
576 /// "oklch(40.101% 0.12332 21.555)".
577 /// https://w3c.github.io/csswg-drafts/css-color-4/#lch-colors
578 Oklch,
579 /// A color specified with the color(..) function and the "srgb-linear"
580 /// color space, e.g. "color(srgb-linear 0.435 0.017 0.055)".
581 SrgbLinear,
582 /// A color specified with the color(..) function and the "display-p3"
583 /// color space, e.g. "color(display-p3 0.84 0.19 0.72)".
584 DisplayP3,
585 /// A color specified with the color(..) function and the "a98-rgb" color
586 /// space, e.g. "color(a98-rgb 0.44091 0.49971 0.37408)".
587 A98Rgb,
588 /// A color specified with the color(..) function and the "prophoto-rgb"
589 /// color space, e.g. "color(prophoto-rgb 0.36589 0.41717 0.31333)".
590 ProphotoRgb,
591 /// A color specified with the color(..) function and the "rec2020" color
592 /// space, e.g. "color(rec2020 0.42210 0.47580 0.35605)".
593 Rec2020,
594 /// A color specified with the color(..) function and the "xyz-d50" color
595 /// space, e.g. "color(xyz-d50 0.2005 0.14089 0.4472)".
596 XyzD50,
597 /// A color specified with the color(..) function and the "xyz-d65" or "xyz"
598 /// color space, e.g. "color(xyz-d65 0.21661 0.14602 0.59452)".
599 /// NOTE: https://drafts.csswg.org/css-color-4/#resolving-color-function-values
600 /// specifies that `xyz` is an alias for the `xyz-d65` color space.
601 XyzD65,
602};
603
604/// https://drafts.csswg.org/css-contain-3/#container-type
605enum class StyleContainerType : uint8_t {
606 /// The `normal` variant.
607 Normal,
608 /// The `inline-size` variant.
609 InlineSize,
610 /// The `size` variant.
611 Size,
612};
613
614/// https://drafts.csswg.org/css-contain-2/#content-visibility
615enum class StyleContentVisibility : uint8_t {
616 /// `auto` variant, the element turns on layout containment, style containment, and paint
617 /// containment. In addition, if the element is not relevant to the user (such as by being
618 /// offscreen) it also skips its content
619 Auto,
620 /// `hidden` variant, the element skips its content
621 Hidden,
622 /// 'visible' variant, no effect
623 Visible,
624};
625
626/// The <coord-box> value, which defines the box that the <offset-path> sizes into.
627/// https://drafts.fxtf.org/motion-1/#valdef-offset-path-coord-box
628///
629/// <coord-box> = content-box | padding-box | border-box | fill-box | stroke-box | view-box
630/// https://drafts.csswg.org/css-box-4/#typedef-coord-box
631enum class StyleCoordBox : uint8_t {
632 ContentBox,
633 PaddingBox,
634 BorderBox,
635 FillBox,
636 StrokeBox,
637 ViewBox,
638};
639
640/// The CORS mode used for a CSS load.
641enum class StyleCorsMode : uint8_t {
642 /// No CORS mode, so cross-origin loads can be done.
643 None,
644 /// Anonymous CORS request.
645 Anonymous,
646};
647
648enum class StyleCounterSystem : uint8_t {
649 Cyclic = 0,
650 Numeric,
651 Alphabetic,
652 Symbolic,
653 Additive,
654 Fixed,
655 Extends,
656};
657
658/// https://drafts.csswg.org/cssom-1/#dom-cssrule-type
659enum class StyleCssRuleType : uint8_t {
660 Style = 1,
661 Import = 3,
662 Media = 4,
663 FontFace = 5,
664 Page = 6,
665 Keyframes = 7,
666 Keyframe = 8,
667 Margin = 9,
668 Namespace = 10,
669 CounterStyle = 11,
670 Supports = 12,
671 Document = 13,
672 FontFeatureValues = 14,
673 LayerBlock = 16,
674 LayerStatement = 17,
675 Container = 18,
676 FontPaletteValues = 19,
677 Property = 20,
678 Scope = 21,
679 StartingStyle = 22,
680 PositionTry = 23,
681 NestedDeclarations = 24,
682};
683
684/// The keywords allowed in the Cursor property.
685///
686/// https://drafts.csswg.org/css-ui-4/#propdef-cursor
687enum class StyleCursorKind : uint8_t {
688 None,
689 Default,
690 Pointer,
691 ContextMenu,
692 Help,
693 Progress,
694 Wait,
695 Cell,
696 Crosshair,
697 Text,
698 VerticalText,
699 Alias,
700 Copy,
701 Move,
702 NoDrop,
703 NotAllowed,
704 Grab,
705 Grabbing,
706 EResize,
707 NResize,
708 NeResize,
709 NwResize,
710 SResize,
711 SeResize,
712 SwResize,
713 WResize,
714 EwResize,
715 NsResize,
716 NeswResize,
717 NwseResize,
718 ColResize,
719 RowResize,
720 AllScroll,
721 ZoomIn,
722 ZoomOut,
723 Auto,
724};
725
726enum class StyleDisplayInside : uint8_t {
727 None = 0,
728 Contents,
729 Flow,
730 FlowRoot,
731 Flex,
732 Grid,
733 Table,
734 TableRowGroup,
735 TableColumn,
736 TableColumnGroup,
737 TableHeaderGroup,
738 TableFooterGroup,
739 TableRow,
740 TableCell,
741#if defined(CBINDGEN_IS_GECKO)
742 Ruby,
743#endif
744#if defined(CBINDGEN_IS_GECKO)
745 RubyBase,
746#endif
747#if defined(CBINDGEN_IS_GECKO)
748 RubyBaseContainer,
749#endif
750#if defined(CBINDGEN_IS_GECKO)
751 RubyText,
752#endif
753#if defined(CBINDGEN_IS_GECKO)
754 RubyTextContainer,
755#endif
756#if defined(CBINDGEN_IS_GECKO)
757 WebkitBox,
758#endif
759};
760
761#if defined(CBINDGEN_IS_GECKO)
762/// Values for the display-mode media feature.
763enum class StyleDisplayMode : uint8_t {
764#if defined(CBINDGEN_IS_GECKO)
765 Browser = 0,
766#endif
767#if defined(CBINDGEN_IS_GECKO)
768 MinimalUi,
769#endif
770#if defined(CBINDGEN_IS_GECKO)
771 Standalone,
772#endif
773#if defined(CBINDGEN_IS_GECKO)
774 Fullscreen,
775#endif
776};
777#endif
778
779/// Defines an element’s display type, which consists of
780/// the two basic qualities of how an element generates boxes
781/// <https://drafts.csswg.org/css-display/#propdef-display>
782enum class StyleDisplayOutside : uint8_t {
783 None = 0,
784 Inline,
785 Block,
786 TableCaption,
787 InternalTable,
788#if defined(CBINDGEN_IS_GECKO)
789 InternalRuby,
790#endif
791};
792
793#if defined(CBINDGEN_IS_GECKO)
794/// Values for the dynamic-range and video-dynamic-range media features.
795/// https://drafts.csswg.org/mediaqueries-5/#dynamic-range
796/// This implements PartialOrd so that lower values will correctly match
797/// higher capabilities.
798enum class StyleDynamicRange : uint8_t {
799#if defined(CBINDGEN_IS_GECKO)
800 Standard,
801#endif
802#if defined(CBINDGEN_IS_GECKO)
803 High,
804#endif
805};
806#endif
807
808enum class StyleFillRule : uint8_t {
809 Nonzero,
810 Evenodd,
811};
812
813/// https://drafts.csswg.org/css-box/#propdef-float
814enum class StyleFloat : uint8_t {
815 Left,
816 Right,
817 None,
818 InlineStart,
819 InlineEnd,
820};
821
822/// A font-display value for a @font-face rule.
823/// The font-display descriptor determines how a font face is displayed based
824/// on whether and when it is downloaded and ready to use.
825enum class StyleFontDisplay : uint8_t {
826 Auto,
827 Block,
828 Swap,
829 Fallback,
830 Optional,
831};
832
833/// Keywords for the font-face src descriptor's format() function.
834/// ('None' and 'Unknown' are for internal use in gfx, not exposed to CSS.)
835enum class StyleFontFaceSourceFormatKeyword : uint8_t {
836 None,
837 Collection,
838 EmbeddedOpentype,
839 Opentype,
840 Svg,
841 Truetype,
842 Woff,
843 Woff2,
844 Unknown,
845};
846
847/// Font family names must either be given quoted as strings,
848/// or unquoted as a sequence of one or more identifiers.
849enum class StyleFontFamilyNameSyntax : uint8_t {
850 /// The family name was specified in a quoted form, e.g. "Font Name"
851 /// or 'Font Name'.
852 Quoted,
853 /// The family name was specified in an unquoted form as a sequence of
854 /// identifiers.
855 Identifiers,
856};
857
858/// CSS font keywords
859enum class StyleFontSizeKeyword : uint8_t {
860 XXSmall,
861 XSmall,
862 Small,
863 Medium,
864 Large,
865 XLarge,
866 XXLarge,
867 XXXLarge,
868#if defined(CBINDGEN_IS_GECKO)
869 /// Indicate whether to apply font-size: math is specified so that extra
870 /// scaling due to math-depth changes is applied during the cascade.
871 Math,
872#endif
873 None,
874};
875
876/// A value for any of the font-synthesis-{weight,style,small-caps} properties.
877enum class StyleFontSynthesis : uint8_t {
878 /// This attribute may be synthesized if not supported by a face.
879 Auto,
880 /// Do not attempt to synthesis this style attribute.
881 None,
882};
883
884/// https://drafts.csswg.org/css-color-adjust-1/#forced-color-adjust-prop
885enum class StyleForcedColorAdjust : uint8_t {
886 /// Adjust colors if needed.
887 Auto,
888 /// Respect specified colors.
889 None,
890};
891
892/// Possible values for the forced-colors media query.
893/// <https://drafts.csswg.org/mediaqueries-5/#forced-colors>
894enum class StyleForcedColors : uint8_t {
895 /// Page colors are not being forced.
896 None,
897 /// Page colors would be forced in content.
898 Requested,
899 /// Page colors are being forced.
900 Active,
901};
902
903/// A generic font-family name.
904///
905/// The order here is important, if you change it make sure that
906/// `gfxPlatformFontList.h`s ranged array and `gfxFontFamilyList`'s
907/// sSingleGenerics are updated as well.
908///
909/// NOTE(emilio): Should be u8, but it's a u32 because of ABI issues between GCC
910/// and LLVM see https://bugs.llvm.org/show_bug.cgi?id=44228 / bug 1600735 /
911/// bug 1726515.
912enum class StyleGenericFontFamily : uint32_t {
913 /// No generic family specified, only for internal usage.
914 ///
915 /// NOTE(emilio): Gecko code relies on this variant being zero.
916 None = 0,
917 Serif,
918 SansSerif,
919 Monospace,
920 Cursive,
921 Fantasy,
922 SystemUi,
923#if defined(CBINDGEN_IS_GECKO)
924 /// An internal value for emoji font selection.
925 MozEmoji,
926#endif
927};
928
929/// Whether we used the modern notation or the compatibility `-webkit`, `-moz` prefixes.
930enum class StyleGradientCompatMode : uint8_t {
931 /// Modern syntax.
932 Modern,
933 /// `-webkit` prefix.
934 WebKit,
935 /// `-moz` prefix
936 Moz,
937};
938
939#if defined(CBINDGEN_IS_GECKO)
940/// Allows front-end CSS to discern gtk theme via media queries.
941enum class StyleGtkThemeFamily : uint8_t {
942#if defined(CBINDGEN_IS_GECKO)
943 /// Unknown theme family.
944 Unknown = 0,
945#endif
946#if defined(CBINDGEN_IS_GECKO)
947 /// Adwaita, the default GTK theme.
948 Adwaita,
949#endif
950#if defined(CBINDGEN_IS_GECKO)
951 /// Breeze, the default KDE theme.
952 Breeze,
953#endif
954#if defined(CBINDGEN_IS_GECKO)
955 /// Yaru, the default Ubuntu theme.
956 Yaru,
957#endif
958};
959#endif
960
961/// A keyword for the X direction.
962enum class StyleHorizontalPositionKeyword : uint8_t {
963 Left,
964 Right,
965};
966
967/// A hue-interpolation-method as defined in [1].
968///
969/// [1]: https://drafts.csswg.org/css-color-4/#typedef-hue-interpolation-method
970enum class StyleHueInterpolationMethod : uint8_t {
971 /// https://drafts.csswg.org/css-color-4/#shorter
972 Shorter,
973 /// https://drafts.csswg.org/css-color-4/#longer
974 Longer,
975 /// https://drafts.csswg.org/css-color-4/#increasing
976 Increasing,
977 /// https://drafts.csswg.org/css-color-4/#decreasing
978 Decreasing,
979 /// https://drafts.csswg.org/css-color-4/#specified
980 Specified,
981};
982
983/// https://drafts.csswg.org/css-images/#propdef-image-rendering
984enum class StyleImageRendering : uint8_t {
985 Auto,
986#if defined(CBINDGEN_IS_GECKO)
987 Smooth,
988#endif
989 CrispEdges,
990 Pixelated,
991#if defined(CBINDGEN_IS_GECKO)
992 Optimizespeed,
993#endif
994#if defined(CBINDGEN_IS_GECKO)
995 Optimizequality,
996#endif
997};
998
999/// Internal property to represent the inert attribute state:
1000/// https://html.spec.whatwg.org/multipage/#inert-subtrees
1001enum class StyleInert : uint8_t {
1002 None,
1003 Inert,
1004};
1005
1006enum class StyleIsOrdinalInRange : uint8_t {
1007 Auto,
1008 InRange,
1009 NotInRange,
1010 NoOrdinalSpecified,
1011};
1012
1013/// Values for the `line-break` property.
1014enum class StyleLineBreak : uint8_t {
1015 Auto,
1016 Loose,
1017 Normal,
1018 Strict,
1019 Anywhere,
1020};
1021
1022/// Masonry auto-placement algorithm item sorting option.
1023enum class StyleMasonryItemOrder : uint8_t {
1024 /// Place all items with a definite placement before auto-placed items.
1025 DefiniteFirst,
1026 /// Place items in `order-modified document order`.
1027 Ordered,
1028};
1029
1030/// Masonry auto-placement algorithm packing.
1031enum class StyleMasonryPlacement : uint8_t {
1032 /// Place the item in the track(s) with the smallest extent so far.
1033 Pack,
1034 /// Place the item after the last item, from start to end.
1035 Next,
1036};
1037
1038/// Whether we're a `min` or `max` function.
1039enum class StyleMinMaxOp : uint8_t {
1040 /// `min()`
1041 Min,
1042 /// `max()`
1043 Max,
1044};
1045
1046/// Whether we're a `mod` or `rem` function.
1047enum class StyleModRemOp : uint8_t {
1048 /// `mod()`
1049 Mod,
1050 /// `rem()`
1051 Rem,
1052};
1053
1054/// Values for the `-moz-control-character-visibility` CSS property.
1055enum class StyleMozControlCharacterVisibility : uint8_t {
1056 Hidden,
1057 Visible,
1058};
1059
1060/// The keywords allowed in the -moz-theme property.
1061enum class StyleMozTheme : uint8_t {
1062 /// Choose the default (maybe native) rendering.
1063 Auto,
1064 /// Choose the non-native rendering.
1065 NonNative,
1066};
1067
1068/// Each style rule has an origin, which determines where it enters the cascade.
1069///
1070/// <https://drafts.csswg.org/css-cascade/#cascading-origins>
1071enum class StyleOrigin : uint8_t {
1072 /// <https://drafts.csswg.org/css-cascade/#cascade-origin-user-agent>
1073 UserAgent = 1,
1074 /// <https://drafts.csswg.org/css-cascade/#cascade-origin-user>
1075 User = 2,
1076 /// <https://drafts.csswg.org/css-cascade/#cascade-origin-author>
1077 Author = 4,
1078};
1079
1080/// The value for the `overflow-x` / `overflow-y` properties.
1081enum class StyleOverflow : uint8_t {
1082 Visible,
1083 Hidden,
1084 Scroll,
1085 Auto,
1086#if defined(CBINDGEN_IS_GECKO)
1087 Clip,
1088#endif
1089};
1090
1091enum class StyleOverflowAnchor : uint8_t {
1092 Auto,
1093 None,
1094};
1095
1096enum class StyleOverflowClipBox : uint8_t {
1097 PaddingBox,
1098 ContentBox,
1099};
1100
1101/// Values for the `overflow-wrap` property.
1102enum class StyleOverflowWrap : uint8_t {
1103 Normal,
1104 BreakWord,
1105 Anywhere,
1106};
1107
1108enum class StyleOverscrollBehavior : uint8_t {
1109 Auto,
1110 Contain,
1111 None,
1112};
1113
1114/// Page orientation names.
1115///
1116/// https://drafts.csswg.org/css-page-3/#page-orientation-prop
1117enum class StylePageOrientation : uint8_t {
1118 /// upright
1119 Upright,
1120 /// rotate-left (counter-clockwise)
1121 RotateLeft,
1122 /// rotate-right (clockwise)
1123 RotateRight,
1124};
1125
1126/// Paper orientation
1127///
1128/// https://drafts.csswg.org/css-page-3/#page-size-prop
1129enum class StylePageSizeOrientation : uint8_t {
1130 /// Portrait orientation
1131 Portrait,
1132 /// Landscape orientation
1133 Landscape,
1134};
1135
1136/// The specified value for a single CSS paint-order property.
1137enum class StylePaintOrder : uint8_t {
1138 /// `normal` variant
1139 Normal = 0,
1140 /// `fill` variant
1141 Fill = 1,
1142 /// `stroke` variant
1143 Stroke = 2,
1144 /// `markers` variant
1145 Markers = 3,
1146};
1147
1148#if defined(CBINDGEN_IS_GECKO)
1149/// Allows front-end CSS to discern platform via media queries.
1150enum class StylePlatform : uint8_t {
1151#if defined(CBINDGEN_IS_GECKO)
1152 /// Matches any Android version.
1153 Android,
1154#endif
1155#if defined(CBINDGEN_IS_GECKO)
1156 /// For our purposes here, "linux" is just "gtk" (so unix-but-not-mac).
1157 /// There's no need for our front-end code to differentiate between those
1158 /// platforms and they already use the "linux" string elsewhere (e.g.,
1159 /// toolkit/themes/linux).
1160 Linux,
1161#endif
1162#if defined(CBINDGEN_IS_GECKO)
1163 /// Matches any iOS version.
1164 Ios,
1165#endif
1166#if defined(CBINDGEN_IS_GECKO)
1167 /// Matches any macOS version.
1168 Macos,
1169#endif
1170#if defined(CBINDGEN_IS_GECKO)
1171 /// Matches any Windows version.
1172 Windows,
1173#endif
1174};
1175#endif
1176
1177/// The pointer-events property
1178/// https://svgwg.org/svg2-draft/interact.html#PointerEventsProperty
1179enum class StylePointerEvents : uint8_t {
1180 Auto,
1181 None,
1182#if defined(CBINDGEN_IS_GECKO)
1183 Visiblepainted,
1184#endif
1185#if defined(CBINDGEN_IS_GECKO)
1186 Visiblefill,
1187#endif
1188#if defined(CBINDGEN_IS_GECKO)
1189 Visiblestroke,
1190#endif
1191#if defined(CBINDGEN_IS_GECKO)
1192 Visible,
1193#endif
1194#if defined(CBINDGEN_IS_GECKO)
1195 Painted,
1196#endif
1197#if defined(CBINDGEN_IS_GECKO)
1198 Fill,
1199#endif
1200#if defined(CBINDGEN_IS_GECKO)
1201 Stroke,
1202#endif
1203#if defined(CBINDGEN_IS_GECKO)
1204 All,
1205#endif
1206};
1207
1208/// Possible values for the `position-area` preperty's keywords.
1209/// https://drafts.csswg.org/css-anchor-position-1/#propdef-position-area
1210enum class StylePositionAreaKeyword : uint8_t {
1211 None,
1212 Center,
1213 SpanAll,
1214 Left,
1215 Right,
1216 SpanLeft,
1217 SpanRight,
1218 XStart,
1219 XEnd,
1220 SpanXStart,
1221 SpanXEnd,
1222 XSelfStart,
1223 XSelfEnd,
1224 SpanXSelfStart,
1225 SpanXSelfEnd,
1226 Top,
1227 Bottom,
1228 SpanTop,
1229 SpanBottom,
1230 YStart,
1231 YEnd,
1232 SpanYStart,
1233 SpanYEnd,
1234 YSelfStart,
1235 YSelfEnd,
1236 SpanYSelfStart,
1237 SpanYSelfEnd,
1238 BlockStart,
1239 BlockEnd,
1240 SpanBlockStart,
1241 SpanBlockEnd,
1242 InlineStart,
1243 InlineEnd,
1244 SpanInlineStart,
1245 SpanInlineEnd,
1246 SelfBlockStart,
1247 SelfBlockEnd,
1248 SpanSelfBlockStart,
1249 SpanSelfBlockEnd,
1250 SelfInlineStart,
1251 SelfInlineEnd,
1252 SpanSelfInlineStart,
1253 SpanSelfInlineEnd,
1254 Start,
1255 End,
1256 SpanStart,
1257 SpanEnd,
1258 SelfStart,
1259 SelfEnd,
1260 SpanSelfStart,
1261 SpanSelfEnd,
1262};
1263
1264/// How to swap values for the automatically-generated position tactic.
1265enum class StylePositionTryFallbacksTryTacticKeyword : uint8_t {
1266 /// Magic value for no change.
1267 None,
1268 /// Swap the values in the block axis.
1269 FlipBlock,
1270 /// Swap the values in the inline axis.
1271 FlipInline,
1272 /// Swap the values in the start properties.
1273 FlipStart,
1274};
1275
1276/// https://drafts.csswg.org/css-anchor-position-1/#position-try-order-property
1277enum class StylePositionTryOrder : uint8_t {
1278 /// `normal`
1279 Normal,
1280 /// `most-width`
1281 MostWidth,
1282 /// `most-height`
1283 MostHeight,
1284 /// `most-block-size`
1285 MostBlockSize,
1286 /// `most-inline-size`
1287 MostInlineSize,
1288};
1289
1290#if defined(CBINDGEN_IS_GECKO)
1291/// Values for the prefers-color-scheme media feature.
1292enum class StylePrefersColorScheme : uint8_t {
1293#if defined(CBINDGEN_IS_GECKO)
1294 Light,
1295#endif
1296#if defined(CBINDGEN_IS_GECKO)
1297 Dark,
1298#endif
1299};
1300#endif
1301
1302#if defined(CBINDGEN_IS_GECKO)
1303/// Possible values for prefers-contrast media query.
1304/// https://drafts.csswg.org/mediaqueries-5/#prefers-contrast
1305enum class StylePrefersContrast : uint8_t {
1306#if defined(CBINDGEN_IS_GECKO)
1307 /// More contrast is preferred.
1308 More,
1309#endif
1310#if defined(CBINDGEN_IS_GECKO)
1311 /// Low contrast is preferred.
1312 Less,
1313#endif
1314#if defined(CBINDGEN_IS_GECKO)
1315 /// Custom (not more, not less).
1316 Custom,
1317#endif
1318#if defined(CBINDGEN_IS_GECKO)
1319 /// The default value if neither high or low contrast is enabled.
1320 NoPreference,
1321#endif
1322};
1323#endif
1324
1325/// https://drafts.csswg.org/css-color-adjust/#print-color-adjust
1326enum class StylePrintColorAdjust : uint8_t {
1327 /// Ignore backgrounds and darken text.
1328 Economy,
1329 /// Respect specified colors.
1330 Exact,
1331};
1332
1333/// The <size> in ray() function.
1334///
1335/// https://drafts.fxtf.org/motion-1/#valdef-offsetpath-size
1336enum class StyleRaySize : uint8_t {
1337 ClosestSide,
1338 ClosestCorner,
1339 FarthestSide,
1340 FarthestCorner,
1341 Sides,
1342};
1343
1344enum class StyleRegisterCustomPropertyResult : uint8_t {
1345 SuccessfullyRegistered,
1346 InvalidName,
1347 AlreadyRegistered,
1348 InvalidSyntax,
1349 NoInitialValue,
1350 InvalidInitialValue,
1351 InitialValueNotComputationallyIndependent,
1352};
1353
1354/// Which edge side should the invalidation run for?
1355enum class StyleRelativeSelectorNthEdgeInvalidateFor : uint8_t {
1356 First,
1357 Last,
1358};
1359
1360/// A computed value for the `resize` property.
1361enum class StyleResize : uint8_t {
1362 None,
1363 Both,
1364 Horizontal,
1365 Vertical,
1366};
1367
1368/// The strategy used in `round()`
1369enum class StyleRoundingStrategy : uint8_t {
1370 /// `round(nearest, a, b)`
1371 /// round a to the nearest multiple of b
1372 Nearest,
1373 /// `round(up, a, b)`
1374 /// round a up to the nearest multiple of b
1375 Up,
1376 /// `round(down, a, b)`
1377 /// round a down to the nearest multiple of b
1378 Down,
1379 /// `round(to-zero, a, b)`
1380 /// round a to the nearest multiple of b that is towards zero
1381 ToZero,
1382};
1383
1384/// Values for `ruby-position` property
1385enum class StyleRubyPosition : uint8_t {
1386 AlternateOver,
1387 AlternateUnder,
1388 Over,
1389 Under,
1390};
1391
1392/// The kind of change that happened for a given rule.
1393enum class StyleRuleChangeKind : uint32_t {
1394 /// Some change in the rule which we don't know about, and could have made
1395 /// the rule change in any way.
1396 Generic = 0,
1397 /// The rule was inserted.
1398 Insertion,
1399 /// The rule was removed.
1400 Removal,
1401 /// A change in the declarations of a style rule.
1402 StyleRuleDeclarations,
1403};
1404
1405/// The kind of sanitization to use when parsing a stylesheet.
1406enum class StyleSanitizationKind : uint8_t {
1407 /// Perform no sanitization.
1408 None,
1409 /// Allow only @font-face, style rules, and @namespace.
1410 Standard,
1411 /// Allow everything but conditional rules.
1412 NoConditionalRules,
1413};
1414
1415#if defined(CBINDGEN_IS_GECKO)
1416/// Values for the scripting media feature.
1417/// https://drafts.csswg.org/mediaqueries-5/#scripting
1418enum class StyleScripting : uint8_t {
1419#if defined(CBINDGEN_IS_GECKO)
1420 /// Scripting is not supported or not enabled
1421 None,
1422#endif
1423#if defined(CBINDGEN_IS_GECKO)
1424 /// Scripting is supported and enabled, but only for initial page load
1425 /// We will never match this value as it is intended for non-browser user agents,
1426 /// but it is part of the spec so we should still parse it.
1427 /// See: https://github.com/w3c/csswg-drafts/issues/8621
1428 InitialOnly,
1429#endif
1430#if defined(CBINDGEN_IS_GECKO)
1431 /// Scripting is supported and enabled
1432 Enabled,
1433#endif
1434};
1435#endif
1436
1437/// A value for the <Axis> used in scroll(), or a value for {scroll|view}-timeline-axis.
1438///
1439/// https://drafts.csswg.org/scroll-animations-1/#typedef-axis
1440/// https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-axis
1441/// https://drafts.csswg.org/scroll-animations-1/#view-timeline-axis
1442enum class StyleScrollAxis : uint8_t {
1443 /// The block axis of the scroll container. (Default.)
1444 Block = 0,
1445 /// The inline axis of the scroll container.
1446 Inline = 1,
1447 /// The horizontal axis of the scroll container.
1448 X = 2,
1449 /// The vertical axis of the scroll container.
1450 Y = 3,
1451};
1452
1453/// Specified value of scroll-snap-align keyword value.
1454enum class StyleScrollSnapAlignKeyword : uint8_t {
1455 None,
1456 Start,
1457 End,
1458 Center,
1459};
1460
1461/// https://drafts.csswg.org/css-scroll-snap-1/#snap-axis
1462enum class StyleScrollSnapAxis : uint8_t {
1463 X,
1464 Y,
1465 Block,
1466 Inline,
1467 Both,
1468};
1469
1470enum class StyleScrollSnapStop : uint8_t {
1471 Normal,
1472 Always,
1473};
1474
1475/// https://drafts.csswg.org/css-scroll-snap-1/#snap-strictness
1476enum class StyleScrollSnapStrictness : uint8_t {
1477 None,
1478 Mandatory,
1479 Proximity,
1480};
1481
1482/// A value for the <Scroller> used in scroll().
1483///
1484/// https://drafts.csswg.org/scroll-animations-1/rewrite#typedef-scroller
1485enum class StyleScroller : uint8_t {
1486 /// The nearest ancestor scroll container. (Default.)
1487 Nearest,
1488 /// The document viewport as the scroll container.
1489 Root,
1490 /// Specifies to use the element’s own principal box as the scroll container.
1491 SelfElement,
1492};
1493
1494/// Any warning a selector may generate.
1495/// TODO(dshin): Bug 1860634 - Merge with never matching host selector warning, which is part of the rule parser.
1496enum class StyleSelectorWarningKind : uint8_t {
1497 /// Relative Selector with not enough constraint, either outside or inside the selector. e.g. `*:has(.a)`, `.a:has(*)`.
1498 /// May cause expensive invalidations for every element inserted and/or removed.
1499 UnconstraintedRelativeSelector,
1500};
1501
1502/// https://drafts.csswg.org/css-shapes-1/#typedef-shape-box
1503enum class StyleShapeBox : uint8_t {
1504 MarginBox,
1505 BorderBox,
1506 PaddingBox,
1507 ContentBox,
1508};
1509
1510/// <https://drafts.csswg.org/css-images/#typedef-extent-keyword>
1511enum class StyleShapeExtent : uint8_t {
1512 ClosestSide,
1513 FarthestSide,
1514 ClosestCorner,
1515 FarthestCorner,
1516 Contain,
1517 Cover,
1518};
1519
1520enum class StyleStepPosition : uint8_t {
1521 JumpStart,
1522 JumpEnd,
1523 JumpNone,
1524 JumpBoth,
1525 Start,
1526 End,
1527};
1528
1529/// https://drafts.csswg.org/css-counter-styles/#typedef-symbols-type
1530enum class StyleSymbolsType : uint8_t {
1531 Cyclic,
1532 Numeric,
1533 Alphabetic,
1534 Symbolic,
1535 Fixed,
1536};
1537
1538#if defined(CBINDGEN_IS_GECKO)
1539/// System colors. A bunch of these are ad-hoc, others come from Windows:
1540///
1541/// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsyscolor
1542///
1543/// Others are HTML/CSS specific. Spec is:
1544///
1545/// https://drafts.csswg.org/css-color/#css-system-colors
1546/// https://drafts.csswg.org/css-color/#deprecated-system-colors
1547enum class StyleSystemColor : uint8_t {
1548 Activeborder,
1549 /// Background in the (active) titlebar.
1550 Activecaption,
1551 Appworkspace,
1552 Background,
1553 Buttonface,
1554 Buttonhighlight,
1555 Buttonshadow,
1556 Buttontext,
1557 Buttonborder,
1558 /// Text color in the (active) titlebar.
1559 Captiontext,
1560 Field,
1561 /// Used for disabled field backgrounds.
1562 MozDisabledfield,
1563 Fieldtext,
1564 Mark,
1565 Marktext,
1566 /// Combobox widgets
1567 MozComboboxtext,
1568 MozCombobox,
1569 Graytext,
1570 Highlight,
1571 Highlighttext,
1572 Inactiveborder,
1573 /// Background in the (inactive) titlebar.
1574 Inactivecaption,
1575 /// Text color in the (inactive) titlebar.
1576 Inactivecaptiontext,
1577 Infobackground,
1578 Infotext,
1579 Menu,
1580 Menutext,
1581 Scrollbar,
1582 Threeddarkshadow,
1583 Threedface,
1584 Threedhighlight,
1585 Threedlightshadow,
1586 Threedshadow,
1587 Window,
1588 Windowframe,
1589 Windowtext,
1590 Canvastext,
1591 Canvas,
1592 MozDialog,
1593 MozDialogtext,
1594 /// Used for selected but not focused cell backgrounds.
1595 MozCellhighlight,
1596 /// Used for selected but not focused cell text.
1597 MozCellhighlighttext,
1598 /// Used for selected and focused html cell backgrounds.
1599 Selecteditem,
1600 /// Used for selected and focused html cell text.
1601 Selecteditemtext,
1602 /// Used to button text background when hovered.
1603 MozButtonhoverface,
1604 /// Used to button text color when hovered.
1605 MozButtonhovertext,
1606 /// Used for menu item backgrounds when hovered.
1607 MozMenuhover,
1608 /// Used for menu item backgrounds when hovered and disabled.
1609 MozMenuhoverdisabled,
1610 /// Used for menu item text when hovered.
1611 MozMenuhovertext,
1612 /// Used for menubar item text when hovered.
1613 MozMenubarhovertext,
1614 /// On platforms where these colors are the same as -moz-field, use
1615 /// -moz-fieldtext as foreground color
1616 MozEventreerow,
1617 MozOddtreerow,
1618 /// Used for button text when pressed.
1619 MozButtonactivetext,
1620 /// Used for button background when pressed.
1621 MozButtonactiveface,
1622 /// Used for button background when disabled.
1623 MozButtondisabledface,
1624 /// Colors used for the header bar (sorta like the tab bar / menubar).
1625 MozHeaderbar,
1626 MozHeaderbartext,
1627 MozHeaderbarinactive,
1628 MozHeaderbarinactivetext,
1629 /// Foreground color of default buttons.
1630 MozMacDefaultbuttontext,
1631 /// Ring color around text fields and lists.
1632 MozMacFocusring,
1633 /// Text color of disabled text on toolbars.
1634 MozMacDisabledtoolbartext,
1635 /// The background of a sidebar.
1636 MozSidebar,
1637 /// The foreground color of a sidebar.
1638 MozSidebartext,
1639 /// The border color of a sidebar.
1640 MozSidebarborder,
1641 /// Theme accent color.
1642 /// https://drafts.csswg.org/css-color-4/#valdef-system-color-accentcolor
1643 Accentcolor,
1644 /// Foreground for the accent color.
1645 /// https://drafts.csswg.org/css-color-4/#valdef-system-color-accentcolortext
1646 Accentcolortext,
1647 /// The background-color for :autofill-ed inputs.
1648 MozAutofillBackground,
1649 /// Hyperlink color extracted from the system, not affected by the browser.anchor_color user
1650 /// pref.
1651 ///
1652 /// There is no OS-specified safe background color for this text, but it is used regularly
1653 /// within Windows and the Gnome DE on Dialog and Window colors.
1654 MozNativehyperlinktext,
1655 /// As above, but visited link color.
1656 MozNativevisitedhyperlinktext,
1657 Linktext,
1658 Activetext,
1659 Visitedtext,
1660 /// Color of tree column headers
1661 MozColheader,
1662 MozColheadertext,
1663 MozColheaderhover,
1664 MozColheaderhovertext,
1665 MozColheaderactive,
1666 MozColheaderactivetext,
1667 TextSelectDisabledBackground,
1668 TextSelectAttentionBackground,
1669 TextSelectAttentionForeground,
1670 TextHighlightBackground,
1671 TextHighlightForeground,
1672 TargetTextBackground,
1673 TargetTextForeground,
1674 IMERawInputBackground,
1675 IMERawInputForeground,
1676 IMERawInputUnderline,
1677 IMESelectedRawTextBackground,
1678 IMESelectedRawTextForeground,
1679 IMESelectedRawTextUnderline,
1680 IMEConvertedTextBackground,
1681 IMEConvertedTextForeground,
1682 IMEConvertedTextUnderline,
1683 IMESelectedConvertedTextBackground,
1684 IMESelectedConvertedTextForeground,
1685 IMESelectedConvertedTextUnderline,
1686 SpellCheckerUnderline,
1687 ThemedScrollbar,
1688 ThemedScrollbarInactive,
1689 ThemedScrollbarThumb,
1690 ThemedScrollbarThumbHover,
1691 ThemedScrollbarThumbActive,
1692 ThemedScrollbarThumbInactive,
1693 End,
1694};
1695#endif
1696
1697#if defined(CBINDGEN_IS_GECKO)
1698/// System fonts.
1699enum class StyleSystemFont : uint8_t {
1700 /// https://drafts.csswg.org/css-fonts/#valdef-font-caption
1701 Caption,
1702 /// https://drafts.csswg.org/css-fonts/#valdef-font-icon
1703 Icon,
1704 /// https://drafts.csswg.org/css-fonts/#valdef-font-menu
1705 Menu,
1706 /// https://drafts.csswg.org/css-fonts/#valdef-font-message-box
1707 MessageBox,
1708 /// https://drafts.csswg.org/css-fonts/#valdef-font-small-caption
1709 SmallCaption,
1710 /// https://drafts.csswg.org/css-fonts/#valdef-font-status-bar
1711 StatusBar,
1712 /// Internal system font, used by the `<menupopup>`s on macOS.
1713 MozPullDownMenu,
1714 /// Internal system font, used for `<button>` elements.
1715 MozButton,
1716 /// Internal font, used by `<select>` elements.
1717 MozList,
1718 /// Internal font, used by `<input>` elements.
1719 MozField,
1720 End,
1721};
1722#endif
1723
1724/// Specified value of text-align keyword value.
1725enum class StyleTextAlignKeyword : uint8_t {
1726 Start,
1727 Left,
1728 Right,
1729 Center,
1730 Justify,
1731 End,
1732 MozCenter,
1733 MozLeft,
1734 MozRight,
1735};
1736
1737/// Specified and computed value of text-align-last.
1738enum class StyleTextAlignLast : uint8_t {
1739 Auto,
1740 Start,
1741 End,
1742 Left,
1743 Right,
1744 Center,
1745 Justify,
1746};
1747
1748/// Implements text-decoration-skip-ink which takes the keywords auto | none | all
1749///
1750/// https://drafts.csswg.org/css-text-decor-4/#text-decoration-skip-ink-property
1751enum class StyleTextDecorationSkipInk : uint8_t {
1752 Auto,
1753 None,
1754 All,
1755};
1756
1757/// Fill mode for the text-emphasis-style property
1758enum class StyleTextEmphasisFillMode : uint8_t {
1759 /// `filled`
1760 Filled,
1761 /// `open`
1762 Open,
1763};
1764
1765/// Shape keyword for the text-emphasis-style property
1766enum class StyleTextEmphasisShapeKeyword : uint8_t {
1767 /// `dot`
1768 Dot,
1769 /// `circle`
1770 Circle,
1771 /// `double-circle`
1772 DoubleCircle,
1773 /// `triangle`
1774 Triangle,
1775 /// `sesame`
1776 Sesame,
1777};
1778
1779/// Values for the `text-justify` CSS property.
1780enum class StyleTextJustify : uint8_t {
1781 Auto,
1782 None,
1783 InterWord,
1784 InterCharacter,
1785};
1786
1787enum class StyleTimingKeyword : uint8_t {
1788 Linear,
1789 Ease,
1790 EaseIn,
1791 EaseOut,
1792 EaseInOut,
1793};
1794
1795/// The specified value of `transform-box`.
1796/// https://drafts.csswg.org/css-transforms-1/#transform-box
1797enum class StyleTransformBox : uint8_t {
1798 ContentBox,
1799 BorderBox,
1800 FillBox,
1801 StrokeBox,
1802 ViewBox,
1803};
1804
1805enum class StyleTransformStyle : uint8_t {
1806 Flat,
1807 Preserve3d,
1808};
1809
1810/// A specified value for <transition-behavior-value>.
1811///
1812/// https://drafts.csswg.org/css-transitions-2/#transition-behavior-property
1813enum class StyleTransitionBehavior : uint8_t {
1814 /// Transitions will not be started for discrete properties, only for interpolable properties.
1815 Normal,
1816 /// Transitions will be started for discrete properties as well as interpolable properties.
1817 AllowDiscrete,
1818};
1819
1820/// Internal -moz-user-focus property.
1821/// https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-user-focus
1822enum class StyleUserFocus : uint8_t {
1823 Normal,
1824 None,
1825 Ignore,
1826};
1827
1828/// Non-standard user-input property.
1829/// https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-user-input
1830enum class StyleUserInput : uint8_t {
1831 Auto,
1832 None,
1833};
1834
1835/// The specified value for the `user-select` property.
1836///
1837/// https://drafts.csswg.org/css-ui-4/#propdef-user-select
1838enum class StyleUserSelect : uint8_t {
1839 Auto,
1840 Text,
1841 None,
1842 /// Force selection of all children.
1843 All,
1844};
1845
1846enum class StyleVerticalAlignKeyword : uint8_t {
1847 Baseline,
1848 Sub,
1849 Super,
1850 Top,
1851 TextTop,
1852 Middle,
1853 Bottom,
1854 TextBottom,
1855#if defined(CBINDGEN_IS_GECKO)
1856 MozMiddleWithBaseline,
1857#endif
1858};
1859
1860/// A keyword for the Y direction.
1861enum class StyleVerticalPositionKeyword : uint8_t {
1862 Top,
1863 Bottom,
1864};
1865
1866/// Values for the `word-break` property.
1867enum class StyleWordBreak : uint8_t {
1868 Normal,
1869 BreakAll,
1870 KeepAll,
1871#if defined(CBINDGEN_IS_GECKO)
1872 /// The break-word value, needed for compat.
1873 ///
1874 /// Specifying `word-break: break-word` makes `overflow-wrap` behave as
1875 /// `anywhere`, and `word-break` behave like `normal`.
1876 BreakWord,
1877#endif
1878};
1879
1880/// How to do font-size scaling.
1881enum class StyleXTextScale : uint8_t {
1882 /// Both min-font-size and text zoom are enabled.
1883 All,
1884 /// Text-only zoom is enabled, but min-font-size is not honored.
1885 ZoomOnly,
1886 /// Neither of them is enabled.
1887 None,
1888};
1889
1890#if defined(CBINDGEN_IS_GECKO)
1891/// Gecko-FFI-safe Arc (T is an ArcInner).
1892///
1893/// This can be null.
1894///
1895/// Leaks on drop. Please don't drop this.
1896template<typename GeckoType>
1897struct StyleStrong {
1898 const GeckoType *ptr;
1899
1900 bool operator==(const StyleStrong& other) const {
1901 return ptr == other.ptr;
1902 }
1903 bool operator!=(const StyleStrong& other) const {
1904 return ptr != other.ptr;
1905 }
1906 already_AddRefed<GeckoType> Consume() {
1907 already_AddRefed<GeckoType> ret(const_cast<GeckoType*>(ptr));
1908 ptr = nullptr;
1909 return ret;
1910 }
1911};
1912#endif
1913
1914/// A CSS float value.
1915using StyleCSSFloat = float;
1916
1917/// A `<number>` value.
1918using StyleNumber = StyleCSSFloat;
1919
1920/// A value of the `Scale` property
1921///
1922/// <https://drafts.csswg.org/css-transforms-2/#individual-transforms>
1923template<typename Number>
1924struct StyleGenericScale {
1925 enum class Tag : uint8_t {
1926 /// 'none'
1927 None,
1928 /// '<number>{1,3}'
1929 Scale,
1930 };
1931
1932 struct StyleScale_Body {
1933 Number _0;
1934 Number _1;
1935 Number _2;
1936
1937 bool operator==(const StyleScale_Body& other) const {
1938 return _0 == other._0 &&
1939 _1 == other._1 &&
1940 _2 == other._2;
1941 }
1942 bool operator!=(const StyleScale_Body& other) const {
1943 return _0 != other._0 ||
1944 _1 != other._1 ||
1945 _2 != other._2;
1946 }
1947 };
1948
1949 Tag tag;
1950 union {
1951 StyleScale_Body scale;
1952 };
1953
1954 static StyleGenericScale None() {
1955 StyleGenericScale result;
1956 result.tag = Tag::None;
1957 return result;
1958 }
1959
1960 bool IsNone() const {
1961 return tag == Tag::None;
1962 }
1963
1964 static StyleGenericScale Scale(const Number &_0,
1965 const Number &_1,
1966 const Number &_2) {
1967 StyleGenericScale result;
1968 ::new (&result.scale._0) (Number)(_0);
1969 ::new (&result.scale._1) (Number)(_1);
1970 ::new (&result.scale._2) (Number)(_2);
1971 result.tag = Tag::Scale;
1972 return result;
1973 }
1974
1975 bool IsScale() const {
1976 return tag == Tag::Scale;
1977 }
1978
1979 const StyleScale_Body& AsScale() const {
1980 MOZ_DIAGNOSTIC_ASSERT(IsScale())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsScale())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsScale()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsScale()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 1980); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsScale()"
")"); do { *((volatile int*)__null) = 1980; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
1981 return scale;
1982 }
1983
1984 bool operator==(const StyleGenericScale& other) const {
1985 if (tag != other.tag) {
1986 return false;
1987 }
1988 switch (tag) {
1989 case Tag::Scale: return scale == other.scale;
1990 default: break;
1991 }
1992 return true;
1993 }
1994
1995 bool operator!=(const StyleGenericScale& other) const {
1996 return !(*this == other);
1997 }
1998
1999 private:
2000 StyleGenericScale() {
2001
2002 }
2003 public:
2004
2005
2006 ~StyleGenericScale() {
2007 switch (tag) {
2008 case Tag::Scale: scale.~StyleScale_Body(); break;
2009 default: break;
2010 }
2011 }
2012
2013 StyleGenericScale(const StyleGenericScale& other)
2014 : tag(other.tag) {
2015 switch (tag) {
2016 case Tag::Scale: ::new (&scale) (StyleScale_Body)(other.scale); break;
2017 default: break;
2018 }
2019 }
2020 StyleGenericScale& operator=(const StyleGenericScale& other) {
2021 if (this != &other) {
2022 this->~StyleGenericScale();
2023 new (this) StyleGenericScale(other);
2024 }
2025 return *this;
2026 }
2027};
2028
2029/// A computed CSS `scale`
2030using StyleScale = StyleGenericScale<StyleNumber>;
2031
2032/// The computed `<length>` value.
2033struct StyleCSSPixelLength {
2034 StyleCSSFloat _0;
2035
2036 bool operator==(const StyleCSSPixelLength& other) const {
2037 return _0 == other._0;
2038 }
2039 bool operator!=(const StyleCSSPixelLength& other) const {
2040 return _0 != other._0;
2041 }
2042 static StyleCSSPixelLength FromPixels(CSSCoord aCoord) { return {aCoord}; }
2043 static StyleCSSPixelLength Zero() { return FromPixels(0.0f); }
2044
2045 inline nscoord ToAppUnits() const;
2046 inline bool IsZero() const;
2047 CSSCoord ToCSSPixels() const { return _0; }
2048 inline void ScaleBy(float);
2049 inline StyleCSSPixelLength ScaledBy(float) const;
2050};
2051
2052/// An alias of computed `<length>` value.
2053using StyleLength = StyleCSSPixelLength;
2054
2055struct StyleLengthVariant {
2056 uint8_t tag;
2057 StyleLength length;
2058
2059 bool operator==(const StyleLengthVariant& other) const {
2060 return tag == other.tag &&
2061 length == other.length;
2062 }
2063 bool operator!=(const StyleLengthVariant& other) const {
2064 return tag != other.tag ||
2065 length != other.length;
2066 }
2067};
2068
2069/// A computed percentage.
2070struct StylePercentage {
2071 StyleCSSFloat _0;
2072
2073 bool operator==(const StylePercentage& other) const {
2074 return _0 == other._0;
2075 }
2076 bool operator!=(const StylePercentage& other) const {
2077 return _0 != other._0;
2078 }
2079};
2080
2081struct StylePercentageVariant {
2082 uint8_t tag;
2083 StylePercentage percentage;
2084
2085 bool operator==(const StylePercentageVariant& other) const {
2086 return tag == other.tag &&
2087 percentage == other.percentage;
2088 }
2089 bool operator!=(const StylePercentageVariant& other) const {
2090 return tag != other.tag ||
2091 percentage != other.percentage;
2092 }
2093};
2094
2095#if defined(SERVO_32_BITS)
2096struct StyleCalcVariant {
2097 uint8_t tag;
2098 void *ptr;
2099
2100 bool operator==(const StyleCalcVariant& other) const {
2101 return tag == other.tag &&
2102 ptr == other.ptr;
2103 }
2104 bool operator!=(const StyleCalcVariant& other) const {
2105 return tag != other.tag ||
2106 ptr != other.ptr;
2107 }
2108};
2109#endif
2110
2111#if defined(HAVE_64BIT_BUILD1)
2112struct StyleCalcVariant {
2113 uintptr_t ptr;
2114
2115 bool operator==(const StyleCalcVariant& other) const {
2116 return ptr == other.ptr;
2117 }
2118 bool operator!=(const StyleCalcVariant& other) const {
2119 return ptr != other.ptr;
2120 }
2121};
2122#endif
2123
2124struct StyleTagVariant {
2125 uint8_t tag;
2126
2127 bool operator==(const StyleTagVariant& other) const {
2128 return tag == other.tag;
2129 }
2130 bool operator!=(const StyleTagVariant& other) const {
2131 return tag != other.tag;
2132 }
2133};
2134
2135union StyleLengthPercentageUnion {
2136 StyleLengthVariant length;
2137 StylePercentageVariant percentage;
2138 StyleCalcVariant calc;
2139 StyleTagVariant tag;
2140 using Self = StyleLengthPercentageUnion;
2141
2142 // TODO(emilio): cbindgen should be able to generate these in the body of the
2143 // union, but it seems it's only implemented for structs, not unions.
2144 static const uint8_t TAG_CALC = StyleLengthPercentageUnion_TAG_CALC;
2145 static const uint8_t TAG_LENGTH = StyleLengthPercentageUnion_TAG_LENGTH;
2146 static const uint8_t TAG_PERCENTAGE = StyleLengthPercentageUnion_TAG_PERCENTAGE;
2147 static const uint8_t TAG_MASK = StyleLengthPercentageUnion_TAG_MASK;
2148
2149 private:
2150 uint8_t Tag() const {
2151 return tag.tag & TAG_MASK;
2152 }
2153
2154 public:
2155 // We need to do all this manually because cbingen can't reason about unions.
2156 inline StyleLengthPercentageUnion();
2157 inline StyleLengthPercentageUnion(const Self&);
2158 inline ~StyleLengthPercentageUnion();
2159 inline Self& operator=(const Self&);
2160
2161 inline bool operator==(const Self& aOther) const;
2162 inline bool operator!=(const Self& aOther) const;
2163
2164 inline bool IsLength() const;
2165 inline bool IsPercentage() const;
2166 inline bool IsCalc() const;
2167
2168 inline const StyleLength& AsLength() const;
2169 inline StyleLength& AsLength();
2170
2171 inline const StylePercentage& AsPercentage() const;
2172 inline StylePercentage& AsPercentage();
2173
2174 inline const StyleCalcLengthPercentage& AsCalc() const;
2175 inline StyleCalcLengthPercentage& AsCalc();
2176
2177 static inline Self Zero();
2178 static inline Self FromAppUnits(nscoord);
2179 static inline Self FromPixels(CSSCoord);
2180 static inline Self FromPercentage(float);
2181
2182 inline void ScaleLengthsBy(float);
2183 inline bool HasPercent() const;
2184 inline bool ConvertsToLength() const;
2185 inline nscoord ToLength() const;
2186 inline CSSCoord ToLengthInCSSPixels() const;
2187 inline bool ConvertsToPercentage() const;
2188 inline bool HasLengthAndPercentage() const;
2189 inline float ToPercentage() const;
2190 inline bool IsDefinitelyZero() const;
2191 inline CSSCoord ResolveToCSSPixels(CSSCoord aPercentageBasisInCSSPixels) const;
2192 template<typename T> inline CSSCoord ResolveToCSSPixelsWith(T aPercentageGetter) const;
2193 template<typename T, typename Rounder>
2194 inline nscoord Resolve(T aPercentageGetter, Rounder) const;
2195 template<typename Rounder>
2196 inline nscoord Resolve(nscoord aPercentageBasis, Rounder) const;
2197 template<typename T> inline nscoord Resolve(T aPercentageGetter) const;
2198 inline nscoord Resolve(nscoord aPercentageBasis) const;
2199};
2200
2201/// A `<length-percentage>` value. This can be either a `<length>`, a
2202/// `<percentage>`, or a combination of both via `calc()`.
2203///
2204///
2205/// https://drafts.csswg.org/css-values-4/#typedef-length-percentage
2206///
2207/// The tag is stored in the lower two bits.
2208///
2209/// We need to use a struct instead of the union directly because unions with
2210/// Drop implementations are unstable, looks like.
2211///
2212/// Also we need the union and the variants to be `pub` (even though the member
2213/// is private) so that cbindgen generates it. They're not part of the public
2214/// API otherwise.
2215using StyleLengthPercentage = StyleLengthPercentageUnion;
2216
2217/// A value of the `translate` property
2218///
2219/// https://drafts.csswg.org/css-transforms-2/#individual-transform-serialization:
2220///
2221/// If a 2d translation is specified, the property must serialize with only one
2222/// or two values (per usual, if the second value is 0px, the default, it must
2223/// be omitted when serializing; however if 0% is the second value, it is included).
2224///
2225/// If a 3d translation is specified and the value can be expressed as 2d, we treat as 2d and
2226/// serialize accoringly. Otherwise, we serialize all three values.
2227/// https://github.com/w3c/csswg-drafts/issues/3305
2228///
2229/// <https://drafts.csswg.org/css-transforms-2/#individual-transforms>
2230template<typename LengthPercentage, typename Length>
2231struct StyleGenericTranslate {
2232 enum class Tag : uint8_t {
2233 /// 'none'
2234 None,
2235 /// <length-percentage> [ <length-percentage> <length>? ]?
2236 Translate,
2237 };
2238
2239 struct StyleTranslate_Body {
2240 LengthPercentage _0;
2241 LengthPercentage _1;
2242 Length _2;
2243
2244 bool operator==(const StyleTranslate_Body& other) const {
2245 return _0 == other._0 &&
2246 _1 == other._1 &&
2247 _2 == other._2;
2248 }
2249 bool operator!=(const StyleTranslate_Body& other) const {
2250 return _0 != other._0 ||
2251 _1 != other._1 ||
2252 _2 != other._2;
2253 }
2254 };
2255
2256 Tag tag;
2257 union {
2258 StyleTranslate_Body translate;
2259 };
2260
2261 static StyleGenericTranslate None() {
2262 StyleGenericTranslate result;
2263 result.tag = Tag::None;
2264 return result;
2265 }
2266
2267 bool IsNone() const {
2268 return tag == Tag::None;
2269 }
2270
2271 static StyleGenericTranslate Translate(const LengthPercentage &_0,
2272 const LengthPercentage &_1,
2273 const Length &_2) {
2274 StyleGenericTranslate result;
2275 ::new (&result.translate._0) (LengthPercentage)(_0);
2276 ::new (&result.translate._1) (LengthPercentage)(_1);
2277 ::new (&result.translate._2) (Length)(_2);
2278 result.tag = Tag::Translate;
2279 return result;
2280 }
2281
2282 bool IsTranslate() const {
2283 return tag == Tag::Translate;
2284 }
2285
2286 const StyleTranslate_Body& AsTranslate() const {
2287 MOZ_DIAGNOSTIC_ASSERT(IsTranslate())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTranslate())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTranslate()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsTranslate()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 2287); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTranslate()"
")"); do { *((volatile int*)__null) = 2287; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
2288 return translate;
2289 }
2290
2291 bool operator==(const StyleGenericTranslate& other) const {
2292 if (tag != other.tag) {
2293 return false;
2294 }
2295 switch (tag) {
2296 case Tag::Translate: return translate == other.translate;
2297 default: break;
2298 }
2299 return true;
2300 }
2301
2302 bool operator!=(const StyleGenericTranslate& other) const {
2303 return !(*this == other);
2304 }
2305
2306 private:
2307 StyleGenericTranslate() {
2308
2309 }
2310 public:
2311
2312
2313 ~StyleGenericTranslate() {
2314 switch (tag) {
2315 case Tag::Translate: translate.~StyleTranslate_Body(); break;
2316 default: break;
2317 }
2318 }
2319
2320 StyleGenericTranslate(const StyleGenericTranslate& other)
2321 : tag(other.tag) {
2322 switch (tag) {
2323 case Tag::Translate: ::new (&translate) (StyleTranslate_Body)(other.translate); break;
2324 default: break;
2325 }
2326 }
2327 StyleGenericTranslate& operator=(const StyleGenericTranslate& other) {
2328 if (this != &other) {
2329 this->~StyleGenericTranslate();
2330 new (this) StyleGenericTranslate(other);
2331 }
2332 return *this;
2333 }
2334};
2335
2336/// A computed CSS `translate`
2337using StyleTranslate = StyleGenericTranslate<StyleLengthPercentage, StyleLength>;
2338
2339/// A computed angle in degrees.
2340struct StyleAngle {
2341 StyleCSSFloat _0;
2342
2343 bool operator==(const StyleAngle& other) const {
2344 return _0 == other._0;
2345 }
2346 bool operator!=(const StyleAngle& other) const {
2347 return _0 != other._0;
2348 }
2349 inline static StyleAngle Zero();
2350 inline float ToDegrees() const;
2351 inline double ToRadians() const;
2352 StyleAngle operator+(const StyleAngle& aAngle) const {
2353 return StyleAngle{_0 + aAngle._0};
2354 }
2355 StyleAngle operator-(const StyleAngle& aAngle) const {
2356 return StyleAngle{_0 - aAngle._0};
2357 }
2358};
2359
2360/// A value of the `Rotate` property
2361///
2362/// <https://drafts.csswg.org/css-transforms-2/#individual-transforms>
2363template<typename Number, typename Angle>
2364struct StyleGenericRotate {
2365 enum class Tag : uint8_t {
2366 /// 'none'
2367 None,
2368 /// '<angle>'
2369 Rotate,
2370 /// '<number>{3} <angle>'
2371 Rotate3D,
2372 };
2373
2374 struct StyleRotate_Body {
2375 Angle _0;
2376
2377 bool operator==(const StyleRotate_Body& other) const {
2378 return _0 == other._0;
2379 }
2380 bool operator!=(const StyleRotate_Body& other) const {
2381 return _0 != other._0;
2382 }
2383 };
2384
2385 struct StyleRotate3D_Body {
2386 Number _0;
2387 Number _1;
2388 Number _2;
2389 Angle _3;
2390
2391 bool operator==(const StyleRotate3D_Body& other) const {
2392 return _0 == other._0 &&
2393 _1 == other._1 &&
2394 _2 == other._2 &&
2395 _3 == other._3;
2396 }
2397 bool operator!=(const StyleRotate3D_Body& other) const {
2398 return _0 != other._0 ||
2399 _1 != other._1 ||
2400 _2 != other._2 ||
2401 _3 != other._3;
2402 }
2403 };
2404
2405 Tag tag;
2406 union {
2407 StyleRotate_Body rotate;
2408 StyleRotate3D_Body rotate3_d;
2409 };
2410
2411 static StyleGenericRotate None() {
2412 StyleGenericRotate result;
2413 result.tag = Tag::None;
2414 return result;
2415 }
2416
2417 bool IsNone() const {
2418 return tag == Tag::None;
2419 }
2420
2421 static StyleGenericRotate Rotate(const Angle &_0) {
2422 StyleGenericRotate result;
2423 ::new (&result.rotate._0) (Angle)(_0);
2424 result.tag = Tag::Rotate;
2425 return result;
2426 }
2427
2428 bool IsRotate() const {
2429 return tag == Tag::Rotate;
2430 }
2431
2432 const Angle& AsRotate() const {
2433 MOZ_DIAGNOSTIC_ASSERT(IsRotate())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRotate())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRotate()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsRotate()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 2433); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRotate()"
")"); do { *((volatile int*)__null) = 2433; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
2434 return rotate._0;
2435 }
2436
2437 static StyleGenericRotate Rotate3D(const Number &_0,
2438 const Number &_1,
2439 const Number &_2,
2440 const Angle &_3) {
2441 StyleGenericRotate result;
2442 ::new (&result.rotate3_d._0) (Number)(_0);
2443 ::new (&result.rotate3_d._1) (Number)(_1);
2444 ::new (&result.rotate3_d._2) (Number)(_2);
2445 ::new (&result.rotate3_d._3) (Angle)(_3);
2446 result.tag = Tag::Rotate3D;
2447 return result;
2448 }
2449
2450 bool IsRotate3D() const {
2451 return tag == Tag::Rotate3D;
2452 }
2453
2454 const StyleRotate3D_Body& AsRotate3D() const {
2455 MOZ_DIAGNOSTIC_ASSERT(IsRotate3D())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRotate3D())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRotate3D()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsRotate3D()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 2455); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRotate3D()"
")"); do { *((volatile int*)__null) = 2455; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
2456 return rotate3_d;
2457 }
2458
2459 bool operator==(const StyleGenericRotate& other) const {
2460 if (tag != other.tag) {
2461 return false;
2462 }
2463 switch (tag) {
2464 case Tag::Rotate: return rotate == other.rotate;
2465 case Tag::Rotate3D: return rotate3_d == other.rotate3_d;
2466 default: break;
2467 }
2468 return true;
2469 }
2470
2471 bool operator!=(const StyleGenericRotate& other) const {
2472 return !(*this == other);
2473 }
2474
2475 private:
2476 StyleGenericRotate() {
2477
2478 }
2479 public:
2480
2481
2482 ~StyleGenericRotate() {
2483 switch (tag) {
2484 case Tag::Rotate: rotate.~StyleRotate_Body(); break;
2485 case Tag::Rotate3D: rotate3_d.~StyleRotate3D_Body(); break;
2486 default: break;
2487 }
2488 }
2489
2490 StyleGenericRotate(const StyleGenericRotate& other)
2491 : tag(other.tag) {
2492 switch (tag) {
2493 case Tag::Rotate: ::new (&rotate) (StyleRotate_Body)(other.rotate); break;
2494 case Tag::Rotate3D: ::new (&rotate3_d) (StyleRotate3D_Body)(other.rotate3_d); break;
2495 default: break;
2496 }
2497 }
2498 StyleGenericRotate& operator=(const StyleGenericRotate& other) {
2499 if (this != &other) {
2500 this->~StyleGenericRotate();
2501 new (this) StyleGenericRotate(other);
2502 }
2503 return *this;
2504 }
2505};
2506
2507/// A computed CSS `rotate`
2508using StyleRotate = StyleGenericRotate<StyleNumber, StyleAngle>;
2509
2510/// A CSS integer value.
2511using StyleCSSInteger = int32_t;
2512
2513/// A `<integer>` value.
2514using StyleInteger = StyleCSSInteger;
2515
2516/// A generic 2D transformation matrix.
2517template<typename T>
2518struct StyleGenericMatrix {
2519 T a;
2520 T b;
2521 T c;
2522 T d;
2523 T e;
2524 T f;
2525
2526 bool operator==(const StyleGenericMatrix& other) const {
2527 return a == other.a &&
2528 b == other.b &&
2529 c == other.c &&
2530 d == other.d &&
2531 e == other.e &&
2532 f == other.f;
2533 }
2534 bool operator!=(const StyleGenericMatrix& other) const {
2535 return a != other.a ||
2536 b != other.b ||
2537 c != other.c ||
2538 d != other.d ||
2539 e != other.e ||
2540 f != other.f;
2541 }
2542};
2543
2544template<typename T>
2545struct StyleGenericMatrix3D {
2546 T m11;
2547 T m12;
2548 T m13;
2549 T m14;
2550 T m21;
2551 T m22;
2552 T m23;
2553 T m24;
2554 T m31;
2555 T m32;
2556 T m33;
2557 T m34;
2558 T m41;
2559 T m42;
2560 T m43;
2561 T m44;
2562
2563 bool operator==(const StyleGenericMatrix3D& other) const {
2564 return m11 == other.m11 &&
2565 m12 == other.m12 &&
2566 m13 == other.m13 &&
2567 m14 == other.m14 &&
2568 m21 == other.m21 &&
2569 m22 == other.m22 &&
2570 m23 == other.m23 &&
2571 m24 == other.m24 &&
2572 m31 == other.m31 &&
2573 m32 == other.m32 &&
2574 m33 == other.m33 &&
2575 m34 == other.m34 &&
2576 m41 == other.m41 &&
2577 m42 == other.m42 &&
2578 m43 == other.m43 &&
2579 m44 == other.m44;
2580 }
2581 bool operator!=(const StyleGenericMatrix3D& other) const {
2582 return m11 != other.m11 ||
2583 m12 != other.m12 ||
2584 m13 != other.m13 ||
2585 m14 != other.m14 ||
2586 m21 != other.m21 ||
2587 m22 != other.m22 ||
2588 m23 != other.m23 ||
2589 m24 != other.m24 ||
2590 m31 != other.m31 ||
2591 m32 != other.m32 ||
2592 m33 != other.m33 ||
2593 m34 != other.m34 ||
2594 m41 != other.m41 ||
2595 m42 != other.m42 ||
2596 m43 != other.m43 ||
2597 m44 != other.m44;
2598 }
2599};
2600
2601/// A value for the `perspective()` transform function, which is either a
2602/// non-negative `<length>` or `none`.
2603template<typename L>
2604struct StyleGenericPerspectiveFunction {
2605 enum class Tag : uint8_t {
2606 /// `none`
2607 None,
2608 /// A `<length>`.
2609 Length,
2610 };
2611
2612 struct StyleLength_Body {
2613 L _0;
2614
2615 bool operator==(const StyleLength_Body& other) const {
2616 return _0 == other._0;
2617 }
2618 bool operator!=(const StyleLength_Body& other) const {
2619 return _0 != other._0;
2620 }
2621 };
2622
2623 Tag tag;
2624 union {
2625 StyleLength_Body length;
2626 };
2627
2628 static StyleGenericPerspectiveFunction None() {
2629 StyleGenericPerspectiveFunction result;
2630 result.tag = Tag::None;
2631 return result;
2632 }
2633
2634 bool IsNone() const {
2635 return tag == Tag::None;
2636 }
2637
2638 static StyleGenericPerspectiveFunction Length(const L &_0) {
2639 StyleGenericPerspectiveFunction result;
2640 ::new (&result.length._0) (L)(_0);
2641 result.tag = Tag::Length;
2642 return result;
2643 }
2644
2645 bool IsLength() const {
2646 return tag == Tag::Length;
2647 }
2648
2649 const L& AsLength() const {
2650 MOZ_DIAGNOSTIC_ASSERT(IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLength()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 2650); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLength()"
")"); do { *((volatile int*)__null) = 2650; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
2651 return length._0;
2652 }
2653
2654 bool operator==(const StyleGenericPerspectiveFunction& other) const {
2655 if (tag != other.tag) {
2656 return false;
2657 }
2658 switch (tag) {
2659 case Tag::Length: return length == other.length;
2660 default: break;
2661 }
2662 return true;
2663 }
2664
2665 bool operator!=(const StyleGenericPerspectiveFunction& other) const {
2666 return !(*this == other);
2667 }
2668
2669 private:
2670 StyleGenericPerspectiveFunction() {
2671
2672 }
2673 public:
2674
2675
2676 ~StyleGenericPerspectiveFunction() {
2677 switch (tag) {
2678 case Tag::Length: length.~StyleLength_Body(); break;
2679 default: break;
2680 }
2681 }
2682
2683 StyleGenericPerspectiveFunction(const StyleGenericPerspectiveFunction& other)
2684 : tag(other.tag) {
2685 switch (tag) {
2686 case Tag::Length: ::new (&length) (StyleLength_Body)(other.length); break;
2687 default: break;
2688 }
2689 }
2690 StyleGenericPerspectiveFunction& operator=(const StyleGenericPerspectiveFunction& other) {
2691 if (this != &other) {
2692 this->~StyleGenericPerspectiveFunction();
2693 new (this) StyleGenericPerspectiveFunction(other);
2694 }
2695 return *this;
2696 }
2697};
2698
2699/// A struct that basically replaces a `Box<[T]>`, but which cbindgen can
2700/// understand.
2701///
2702/// We could rely on the struct layout of `Box<[T]>` per:
2703///
2704/// https://github.com/rust-lang/unsafe-code-guidelines/blob/master/reference/src/layout/pointers.md
2705///
2706/// But handling fat pointers with cbindgen both in structs and argument
2707/// positions more generally is a bit tricky.
2708///
2709template<typename T>
2710struct StyleOwnedSlice {
2711 T *ptr;
2712 uintptr_t len;
2713 constexpr StyleOwnedSlice() :
2714 ptr((T*)alignof(T)),
2715 len(0) {}
2716
2717 inline void Clear();
2718 inline void CopyFrom(const StyleOwnedSlice&);
2719 inline void SwapElements(StyleOwnedSlice&);
2720
2721 StyleOwnedSlice& operator=(const StyleOwnedSlice&);
2722 StyleOwnedSlice& operator=(StyleOwnedSlice&&);
2723
2724 inline StyleOwnedSlice(const StyleOwnedSlice&);
2725 inline StyleOwnedSlice(StyleOwnedSlice&&);
2726 inline explicit StyleOwnedSlice(Vector<T>&&);
2727
2728 inline ~StyleOwnedSlice();
2729
2730 Span<const T> AsSpan() const {
2731 return {ptr, len};
2732 }
2733
2734 size_t Length() const {
2735 return len;
2736 }
2737
2738 bool IsEmpty() const { return Length() == 0; }
2739
2740 bool operator==(const StyleOwnedSlice& other) const {
2741 return AsSpan() == other.AsSpan();
2742 }
2743
2744 bool operator!=(const StyleOwnedSlice& other) const {
2745 return !(*this == other);
2746 }
2747};
2748
2749/// A value of the `transform` property
2750template<typename T>
2751struct StyleGenericTransform {
2752 StyleOwnedSlice<T> _0;
2753
2754 bool operator==(const StyleGenericTransform& other) const {
2755 return _0 == other._0;
2756 }
2757 bool operator!=(const StyleGenericTransform& other) const {
2758 return _0 != other._0;
2759 }
2760 inline Span<const T> Operations() const;
2761 inline bool IsNone() const;
2762 bool HasPercent() const;
2763};
2764
2765/// A single operation in the list of a `transform` value
2766template<typename Angle, typename Number, typename Length, typename Integer, typename LengthPercentage>
2767struct StyleGenericTransformOperation {
2768 enum class Tag : uint8_t {
2769 /// Represents a 2D 2x3 matrix.
2770 Matrix,
2771 /// Represents a 3D 4x4 matrix.
2772 Matrix3D,
2773 /// A 2D skew.
2774 ///
2775 /// If the second angle is not provided it is assumed zero.
2776 ///
2777 /// Syntax can be skew(angle) or skew(angle, angle)
2778 Skew,
2779 /// skewX(angle)
2780 SkewX,
2781 /// skewY(angle)
2782 SkewY,
2783 /// translate(x, y) or translate(x)
2784 Translate,
2785 /// translateX(x)
2786 TranslateX,
2787 /// translateY(y)
2788 TranslateY,
2789 /// translateZ(z)
2790 TranslateZ,
2791 /// translate3d(x, y, z)
2792 Translate3D,
2793 /// A 2D scaling factor.
2794 ///
2795 /// Syntax can be scale(factor) or scale(factor, factor)
2796 Scale,
2797 /// scaleX(factor)
2798 ScaleX,
2799 /// scaleY(factor)
2800 ScaleY,
2801 /// scaleZ(factor)
2802 ScaleZ,
2803 /// scale3D(factorX, factorY, factorZ)
2804 Scale3D,
2805 /// Describes a 2D Rotation.
2806 ///
2807 /// In a 3D scene `rotate(angle)` is equivalent to `rotateZ(angle)`.
2808 Rotate,
2809 /// Rotation in 3D space around the x-axis.
2810 RotateX,
2811 /// Rotation in 3D space around the y-axis.
2812 RotateY,
2813 /// Rotation in 3D space around the z-axis.
2814 RotateZ,
2815 /// Rotation in 3D space.
2816 ///
2817 /// Generalization of rotateX, rotateY and rotateZ.
2818 Rotate3D,
2819 /// Specifies a perspective projection matrix.
2820 ///
2821 /// Part of CSS Transform Module Level 2 and defined at
2822 /// [§ 13.1. 3D Transform Function](https://drafts.csswg.org/css-transforms-2/#funcdef-perspective).
2823 ///
2824 /// The value must be greater than or equal to zero.
2825 Perspective,
2826 /// A intermediate type for interpolation of mismatched transform lists.
2827 InterpolateMatrix,
2828 /// A intermediate type for accumulation of mismatched transform lists.
2829 AccumulateMatrix,
2830 };
2831
2832 struct StyleMatrix_Body {
2833 StyleGenericMatrix<Number> _0;
2834
2835 bool operator==(const StyleMatrix_Body& other) const {
2836 return _0 == other._0;
2837 }
2838 bool operator!=(const StyleMatrix_Body& other) const {
2839 return _0 != other._0;
2840 }
2841 };
2842
2843 struct StyleMatrix3D_Body {
2844 StyleGenericMatrix3D<Number> _0;
2845
2846 bool operator==(const StyleMatrix3D_Body& other) const {
2847 return _0 == other._0;
2848 }
2849 bool operator!=(const StyleMatrix3D_Body& other) const {
2850 return _0 != other._0;
2851 }
2852 };
2853
2854 struct StyleSkew_Body {
2855 Angle _0;
2856 Angle _1;
2857
2858 bool operator==(const StyleSkew_Body& other) const {
2859 return _0 == other._0 &&
2860 _1 == other._1;
2861 }
2862 bool operator!=(const StyleSkew_Body& other) const {
2863 return _0 != other._0 ||
2864 _1 != other._1;
2865 }
2866 };
2867
2868 struct StyleSkewX_Body {
2869 Angle _0;
2870
2871 bool operator==(const StyleSkewX_Body& other) const {
2872 return _0 == other._0;
2873 }
2874 bool operator!=(const StyleSkewX_Body& other) const {
2875 return _0 != other._0;
2876 }
2877 };
2878
2879 struct StyleSkewY_Body {
2880 Angle _0;
2881
2882 bool operator==(const StyleSkewY_Body& other) const {
2883 return _0 == other._0;
2884 }
2885 bool operator!=(const StyleSkewY_Body& other) const {
2886 return _0 != other._0;
2887 }
2888 };
2889
2890 struct StyleTranslate_Body {
2891 LengthPercentage _0;
2892 LengthPercentage _1;
2893
2894 bool operator==(const StyleTranslate_Body& other) const {
2895 return _0 == other._0 &&
2896 _1 == other._1;
2897 }
2898 bool operator!=(const StyleTranslate_Body& other) const {
2899 return _0 != other._0 ||
2900 _1 != other._1;
2901 }
2902 };
2903
2904 struct StyleTranslateX_Body {
2905 LengthPercentage _0;
2906
2907 bool operator==(const StyleTranslateX_Body& other) const {
2908 return _0 == other._0;
2909 }
2910 bool operator!=(const StyleTranslateX_Body& other) const {
2911 return _0 != other._0;
2912 }
2913 };
2914
2915 struct StyleTranslateY_Body {
2916 LengthPercentage _0;
2917
2918 bool operator==(const StyleTranslateY_Body& other) const {
2919 return _0 == other._0;
2920 }
2921 bool operator!=(const StyleTranslateY_Body& other) const {
2922 return _0 != other._0;
2923 }
2924 };
2925
2926 struct StyleTranslateZ_Body {
2927 Length _0;
2928
2929 bool operator==(const StyleTranslateZ_Body& other) const {
2930 return _0 == other._0;
2931 }
2932 bool operator!=(const StyleTranslateZ_Body& other) const {
2933 return _0 != other._0;
2934 }
2935 };
2936
2937 struct StyleTranslate3D_Body {
2938 LengthPercentage _0;
2939 LengthPercentage _1;
2940 Length _2;
2941
2942 bool operator==(const StyleTranslate3D_Body& other) const {
2943 return _0 == other._0 &&
2944 _1 == other._1 &&
2945 _2 == other._2;
2946 }
2947 bool operator!=(const StyleTranslate3D_Body& other) const {
2948 return _0 != other._0 ||
2949 _1 != other._1 ||
2950 _2 != other._2;
2951 }
2952 };
2953
2954 struct StyleScale_Body {
2955 Number _0;
2956 Number _1;
2957
2958 bool operator==(const StyleScale_Body& other) const {
2959 return _0 == other._0 &&
2960 _1 == other._1;
2961 }
2962 bool operator!=(const StyleScale_Body& other) const {
2963 return _0 != other._0 ||
2964 _1 != other._1;
2965 }
2966 };
2967
2968 struct StyleScaleX_Body {
2969 Number _0;
2970
2971 bool operator==(const StyleScaleX_Body& other) const {
2972 return _0 == other._0;
2973 }
2974 bool operator!=(const StyleScaleX_Body& other) const {
2975 return _0 != other._0;
2976 }
2977 };
2978
2979 struct StyleScaleY_Body {
2980 Number _0;
2981
2982 bool operator==(const StyleScaleY_Body& other) const {
2983 return _0 == other._0;
2984 }
2985 bool operator!=(const StyleScaleY_Body& other) const {
2986 return _0 != other._0;
2987 }
2988 };
2989
2990 struct StyleScaleZ_Body {
2991 Number _0;
2992
2993 bool operator==(const StyleScaleZ_Body& other) const {
2994 return _0 == other._0;
2995 }
2996 bool operator!=(const StyleScaleZ_Body& other) const {
2997 return _0 != other._0;
2998 }
2999 };
3000
3001 struct StyleScale3D_Body {
3002 Number _0;
3003 Number _1;
3004 Number _2;
3005
3006 bool operator==(const StyleScale3D_Body& other) const {
3007 return _0 == other._0 &&
3008 _1 == other._1 &&
3009 _2 == other._2;
3010 }
3011 bool operator!=(const StyleScale3D_Body& other) const {
3012 return _0 != other._0 ||
3013 _1 != other._1 ||
3014 _2 != other._2;
3015 }
3016 };
3017
3018 struct StyleRotate_Body {
3019 Angle _0;
3020
3021 bool operator==(const StyleRotate_Body& other) const {
3022 return _0 == other._0;
3023 }
3024 bool operator!=(const StyleRotate_Body& other) const {
3025 return _0 != other._0;
3026 }
3027 };
3028
3029 struct StyleRotateX_Body {
3030 Angle _0;
3031
3032 bool operator==(const StyleRotateX_Body& other) const {
3033 return _0 == other._0;
3034 }
3035 bool operator!=(const StyleRotateX_Body& other) const {
3036 return _0 != other._0;
3037 }
3038 };
3039
3040 struct StyleRotateY_Body {
3041 Angle _0;
3042
3043 bool operator==(const StyleRotateY_Body& other) const {
3044 return _0 == other._0;
3045 }
3046 bool operator!=(const StyleRotateY_Body& other) const {
3047 return _0 != other._0;
3048 }
3049 };
3050
3051 struct StyleRotateZ_Body {
3052 Angle _0;
3053
3054 bool operator==(const StyleRotateZ_Body& other) const {
3055 return _0 == other._0;
3056 }
3057 bool operator!=(const StyleRotateZ_Body& other) const {
3058 return _0 != other._0;
3059 }
3060 };
3061
3062 struct StyleRotate3D_Body {
3063 Number _0;
3064 Number _1;
3065 Number _2;
3066 Angle _3;
3067
3068 bool operator==(const StyleRotate3D_Body& other) const {
3069 return _0 == other._0 &&
3070 _1 == other._1 &&
3071 _2 == other._2 &&
3072 _3 == other._3;
3073 }
3074 bool operator!=(const StyleRotate3D_Body& other) const {
3075 return _0 != other._0 ||
3076 _1 != other._1 ||
3077 _2 != other._2 ||
3078 _3 != other._3;
3079 }
3080 };
3081
3082 struct StylePerspective_Body {
3083 StyleGenericPerspectiveFunction<Length> _0;
3084
3085 bool operator==(const StylePerspective_Body& other) const {
3086 return _0 == other._0;
3087 }
3088 bool operator!=(const StylePerspective_Body& other) const {
3089 return _0 != other._0;
3090 }
3091 };
3092
3093 struct StyleInterpolateMatrix_Body {
3094 StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>> from_list;
3095 StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>> to_list;
3096 StylePercentage progress;
3097
3098 bool operator==(const StyleInterpolateMatrix_Body& other) const {
3099 return from_list == other.from_list &&
3100 to_list == other.to_list &&
3101 progress == other.progress;
3102 }
3103 bool operator!=(const StyleInterpolateMatrix_Body& other) const {
3104 return from_list != other.from_list ||
3105 to_list != other.to_list ||
3106 progress != other.progress;
3107 }
3108 };
3109
3110 struct StyleAccumulateMatrix_Body {
3111 StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>> from_list;
3112 StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>> to_list;
3113 Integer count;
3114
3115 bool operator==(const StyleAccumulateMatrix_Body& other) const {
3116 return from_list == other.from_list &&
3117 to_list == other.to_list &&
3118 count == other.count;
3119 }
3120 bool operator!=(const StyleAccumulateMatrix_Body& other) const {
3121 return from_list != other.from_list ||
3122 to_list != other.to_list ||
3123 count != other.count;
3124 }
3125 };
3126
3127 Tag tag;
3128 union {
3129 StyleMatrix_Body matrix;
3130 StyleMatrix3D_Body matrix3_d;
3131 StyleSkew_Body skew;
3132 StyleSkewX_Body skew_x;
3133 StyleSkewY_Body skew_y;
3134 StyleTranslate_Body translate;
3135 StyleTranslateX_Body translate_x;
3136 StyleTranslateY_Body translate_y;
3137 StyleTranslateZ_Body translate_z;
3138 StyleTranslate3D_Body translate3_d;
3139 StyleScale_Body scale;
3140 StyleScaleX_Body scale_x;
3141 StyleScaleY_Body scale_y;
3142 StyleScaleZ_Body scale_z;
3143 StyleScale3D_Body scale3_d;
3144 StyleRotate_Body rotate;
3145 StyleRotateX_Body rotate_x;
3146 StyleRotateY_Body rotate_y;
3147 StyleRotateZ_Body rotate_z;
3148 StyleRotate3D_Body rotate3_d;
3149 StylePerspective_Body perspective;
3150 StyleInterpolateMatrix_Body interpolate_matrix;
3151 StyleAccumulateMatrix_Body accumulate_matrix;
3152 };
3153
3154 static StyleGenericTransformOperation Matrix(const StyleGenericMatrix<Number> &_0) {
3155 StyleGenericTransformOperation result;
3156 ::new (&result.matrix._0) (StyleGenericMatrix<Number>)(_0);
3157 result.tag = Tag::Matrix;
3158 return result;
3159 }
3160
3161 bool IsMatrix() const {
3162 return tag == Tag::Matrix;
3163 }
3164
3165 const StyleGenericMatrix<Number>& AsMatrix() const {
3166 MOZ_DIAGNOSTIC_ASSERT(IsMatrix())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsMatrix())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsMatrix()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsMatrix()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3166); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsMatrix()"
")"); do { *((volatile int*)__null) = 3166; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3167 return matrix._0;
3168 }
3169
3170 static StyleGenericTransformOperation Matrix3D(const StyleGenericMatrix3D<Number> &_0) {
3171 StyleGenericTransformOperation result;
3172 ::new (&result.matrix3_d._0) (StyleGenericMatrix3D<Number>)(_0);
3173 result.tag = Tag::Matrix3D;
3174 return result;
3175 }
3176
3177 bool IsMatrix3D() const {
3178 return tag == Tag::Matrix3D;
3179 }
3180
3181 const StyleGenericMatrix3D<Number>& AsMatrix3D() const {
3182 MOZ_DIAGNOSTIC_ASSERT(IsMatrix3D())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsMatrix3D())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsMatrix3D()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsMatrix3D()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3182); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsMatrix3D()"
")"); do { *((volatile int*)__null) = 3182; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3183 return matrix3_d._0;
3184 }
3185
3186 static StyleGenericTransformOperation Skew(const Angle &_0,
3187 const Angle &_1) {
3188 StyleGenericTransformOperation result;
3189 ::new (&result.skew._0) (Angle)(_0);
3190 ::new (&result.skew._1) (Angle)(_1);
3191 result.tag = Tag::Skew;
3192 return result;
3193 }
3194
3195 bool IsSkew() const {
3196 return tag == Tag::Skew;
3197 }
3198
3199 const StyleSkew_Body& AsSkew() const {
3200 MOZ_DIAGNOSTIC_ASSERT(IsSkew())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSkew())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSkew()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSkew()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3200); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSkew()"
")"); do { *((volatile int*)__null) = 3200; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3201 return skew;
3202 }
3203
3204 static StyleGenericTransformOperation SkewX(const Angle &_0) {
3205 StyleGenericTransformOperation result;
3206 ::new (&result.skew_x._0) (Angle)(_0);
3207 result.tag = Tag::SkewX;
3208 return result;
3209 }
3210
3211 bool IsSkewX() const {
3212 return tag == Tag::SkewX;
3213 }
3214
3215 const Angle& AsSkewX() const {
3216 MOZ_DIAGNOSTIC_ASSERT(IsSkewX())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSkewX())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSkewX()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSkewX()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3216); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSkewX()"
")"); do { *((volatile int*)__null) = 3216; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3217 return skew_x._0;
3218 }
3219
3220 static StyleGenericTransformOperation SkewY(const Angle &_0) {
3221 StyleGenericTransformOperation result;
3222 ::new (&result.skew_y._0) (Angle)(_0);
3223 result.tag = Tag::SkewY;
3224 return result;
3225 }
3226
3227 bool IsSkewY() const {
3228 return tag == Tag::SkewY;
3229 }
3230
3231 const Angle& AsSkewY() const {
3232 MOZ_DIAGNOSTIC_ASSERT(IsSkewY())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSkewY())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSkewY()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSkewY()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3232); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSkewY()"
")"); do { *((volatile int*)__null) = 3232; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3233 return skew_y._0;
3234 }
3235
3236 static StyleGenericTransformOperation Translate(const LengthPercentage &_0,
3237 const LengthPercentage &_1) {
3238 StyleGenericTransformOperation result;
3239 ::new (&result.translate._0) (LengthPercentage)(_0);
3240 ::new (&result.translate._1) (LengthPercentage)(_1);
3241 result.tag = Tag::Translate;
3242 return result;
3243 }
3244
3245 bool IsTranslate() const {
3246 return tag == Tag::Translate;
3247 }
3248
3249 const StyleTranslate_Body& AsTranslate() const {
3250 MOZ_DIAGNOSTIC_ASSERT(IsTranslate())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTranslate())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTranslate()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsTranslate()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3250); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTranslate()"
")"); do { *((volatile int*)__null) = 3250; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3251 return translate;
3252 }
3253
3254 static StyleGenericTransformOperation TranslateX(const LengthPercentage &_0) {
3255 StyleGenericTransformOperation result;
3256 ::new (&result.translate_x._0) (LengthPercentage)(_0);
3257 result.tag = Tag::TranslateX;
3258 return result;
3259 }
3260
3261 bool IsTranslateX() const {
3262 return tag == Tag::TranslateX;
3263 }
3264
3265 const LengthPercentage& AsTranslateX() const {
3266 MOZ_DIAGNOSTIC_ASSERT(IsTranslateX())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTranslateX())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTranslateX()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsTranslateX()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3266); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTranslateX()"
")"); do { *((volatile int*)__null) = 3266; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3267 return translate_x._0;
3268 }
3269
3270 static StyleGenericTransformOperation TranslateY(const LengthPercentage &_0) {
3271 StyleGenericTransformOperation result;
3272 ::new (&result.translate_y._0) (LengthPercentage)(_0);
3273 result.tag = Tag::TranslateY;
3274 return result;
3275 }
3276
3277 bool IsTranslateY() const {
3278 return tag == Tag::TranslateY;
3279 }
3280
3281 const LengthPercentage& AsTranslateY() const {
3282 MOZ_DIAGNOSTIC_ASSERT(IsTranslateY())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTranslateY())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTranslateY()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsTranslateY()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3282); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTranslateY()"
")"); do { *((volatile int*)__null) = 3282; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3283 return translate_y._0;
3284 }
3285
3286 static StyleGenericTransformOperation TranslateZ(const Length &_0) {
3287 StyleGenericTransformOperation result;
3288 ::new (&result.translate_z._0) (Length)(_0);
3289 result.tag = Tag::TranslateZ;
3290 return result;
3291 }
3292
3293 bool IsTranslateZ() const {
3294 return tag == Tag::TranslateZ;
3295 }
3296
3297 const Length& AsTranslateZ() const {
3298 MOZ_DIAGNOSTIC_ASSERT(IsTranslateZ())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTranslateZ())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTranslateZ()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsTranslateZ()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3298); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTranslateZ()"
")"); do { *((volatile int*)__null) = 3298; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3299 return translate_z._0;
3300 }
3301
3302 static StyleGenericTransformOperation Translate3D(const LengthPercentage &_0,
3303 const LengthPercentage &_1,
3304 const Length &_2) {
3305 StyleGenericTransformOperation result;
3306 ::new (&result.translate3_d._0) (LengthPercentage)(_0);
3307 ::new (&result.translate3_d._1) (LengthPercentage)(_1);
3308 ::new (&result.translate3_d._2) (Length)(_2);
3309 result.tag = Tag::Translate3D;
3310 return result;
3311 }
3312
3313 bool IsTranslate3D() const {
3314 return tag == Tag::Translate3D;
3315 }
3316
3317 const StyleTranslate3D_Body& AsTranslate3D() const {
3318 MOZ_DIAGNOSTIC_ASSERT(IsTranslate3D())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTranslate3D())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTranslate3D()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsTranslate3D()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3318); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTranslate3D()"
")"); do { *((volatile int*)__null) = 3318; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3319 return translate3_d;
3320 }
3321
3322 static StyleGenericTransformOperation Scale(const Number &_0,
3323 const Number &_1) {
3324 StyleGenericTransformOperation result;
3325 ::new (&result.scale._0) (Number)(_0);
3326 ::new (&result.scale._1) (Number)(_1);
3327 result.tag = Tag::Scale;
3328 return result;
3329 }
3330
3331 bool IsScale() const {
3332 return tag == Tag::Scale;
3333 }
3334
3335 const StyleScale_Body& AsScale() const {
3336 MOZ_DIAGNOSTIC_ASSERT(IsScale())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsScale())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsScale()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsScale()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3336); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsScale()"
")"); do { *((volatile int*)__null) = 3336; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3337 return scale;
3338 }
3339
3340 static StyleGenericTransformOperation ScaleX(const Number &_0) {
3341 StyleGenericTransformOperation result;
3342 ::new (&result.scale_x._0) (Number)(_0);
3343 result.tag = Tag::ScaleX;
3344 return result;
3345 }
3346
3347 bool IsScaleX() const {
3348 return tag == Tag::ScaleX;
3349 }
3350
3351 const Number& AsScaleX() const {
3352 MOZ_DIAGNOSTIC_ASSERT(IsScaleX())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsScaleX())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsScaleX()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsScaleX()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3352); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsScaleX()"
")"); do { *((volatile int*)__null) = 3352; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3353 return scale_x._0;
3354 }
3355
3356 static StyleGenericTransformOperation ScaleY(const Number &_0) {
3357 StyleGenericTransformOperation result;
3358 ::new (&result.scale_y._0) (Number)(_0);
3359 result.tag = Tag::ScaleY;
3360 return result;
3361 }
3362
3363 bool IsScaleY() const {
3364 return tag == Tag::ScaleY;
3365 }
3366
3367 const Number& AsScaleY() const {
3368 MOZ_DIAGNOSTIC_ASSERT(IsScaleY())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsScaleY())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsScaleY()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsScaleY()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3368); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsScaleY()"
")"); do { *((volatile int*)__null) = 3368; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3369 return scale_y._0;
3370 }
3371
3372 static StyleGenericTransformOperation ScaleZ(const Number &_0) {
3373 StyleGenericTransformOperation result;
3374 ::new (&result.scale_z._0) (Number)(_0);
3375 result.tag = Tag::ScaleZ;
3376 return result;
3377 }
3378
3379 bool IsScaleZ() const {
3380 return tag == Tag::ScaleZ;
3381 }
3382
3383 const Number& AsScaleZ() const {
3384 MOZ_DIAGNOSTIC_ASSERT(IsScaleZ())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsScaleZ())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsScaleZ()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsScaleZ()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3384); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsScaleZ()"
")"); do { *((volatile int*)__null) = 3384; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3385 return scale_z._0;
3386 }
3387
3388 static StyleGenericTransformOperation Scale3D(const Number &_0,
3389 const Number &_1,
3390 const Number &_2) {
3391 StyleGenericTransformOperation result;
3392 ::new (&result.scale3_d._0) (Number)(_0);
3393 ::new (&result.scale3_d._1) (Number)(_1);
3394 ::new (&result.scale3_d._2) (Number)(_2);
3395 result.tag = Tag::Scale3D;
3396 return result;
3397 }
3398
3399 bool IsScale3D() const {
3400 return tag == Tag::Scale3D;
3401 }
3402
3403 const StyleScale3D_Body& AsScale3D() const {
3404 MOZ_DIAGNOSTIC_ASSERT(IsScale3D())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsScale3D())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsScale3D()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsScale3D()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3404); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsScale3D()"
")"); do { *((volatile int*)__null) = 3404; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3405 return scale3_d;
3406 }
3407
3408 static StyleGenericTransformOperation Rotate(const Angle &_0) {
3409 StyleGenericTransformOperation result;
3410 ::new (&result.rotate._0) (Angle)(_0);
3411 result.tag = Tag::Rotate;
3412 return result;
3413 }
3414
3415 bool IsRotate() const {
3416 return tag == Tag::Rotate;
3417 }
3418
3419 const Angle& AsRotate() const {
3420 MOZ_DIAGNOSTIC_ASSERT(IsRotate())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRotate())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRotate()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsRotate()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3420); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRotate()"
")"); do { *((volatile int*)__null) = 3420; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3421 return rotate._0;
3422 }
3423
3424 static StyleGenericTransformOperation RotateX(const Angle &_0) {
3425 StyleGenericTransformOperation result;
3426 ::new (&result.rotate_x._0) (Angle)(_0);
3427 result.tag = Tag::RotateX;
3428 return result;
3429 }
3430
3431 bool IsRotateX() const {
3432 return tag == Tag::RotateX;
3433 }
3434
3435 const Angle& AsRotateX() const {
3436 MOZ_DIAGNOSTIC_ASSERT(IsRotateX())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRotateX())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRotateX()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsRotateX()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3436); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRotateX()"
")"); do { *((volatile int*)__null) = 3436; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3437 return rotate_x._0;
3438 }
3439
3440 static StyleGenericTransformOperation RotateY(const Angle &_0) {
3441 StyleGenericTransformOperation result;
3442 ::new (&result.rotate_y._0) (Angle)(_0);
3443 result.tag = Tag::RotateY;
3444 return result;
3445 }
3446
3447 bool IsRotateY() const {
3448 return tag == Tag::RotateY;
3449 }
3450
3451 const Angle& AsRotateY() const {
3452 MOZ_DIAGNOSTIC_ASSERT(IsRotateY())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRotateY())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRotateY()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsRotateY()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3452); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRotateY()"
")"); do { *((volatile int*)__null) = 3452; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3453 return rotate_y._0;
3454 }
3455
3456 static StyleGenericTransformOperation RotateZ(const Angle &_0) {
3457 StyleGenericTransformOperation result;
3458 ::new (&result.rotate_z._0) (Angle)(_0);
3459 result.tag = Tag::RotateZ;
3460 return result;
3461 }
3462
3463 bool IsRotateZ() const {
3464 return tag == Tag::RotateZ;
3465 }
3466
3467 const Angle& AsRotateZ() const {
3468 MOZ_DIAGNOSTIC_ASSERT(IsRotateZ())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRotateZ())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRotateZ()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsRotateZ()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3468); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRotateZ()"
")"); do { *((volatile int*)__null) = 3468; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3469 return rotate_z._0;
3470 }
3471
3472 static StyleGenericTransformOperation Rotate3D(const Number &_0,
3473 const Number &_1,
3474 const Number &_2,
3475 const Angle &_3) {
3476 StyleGenericTransformOperation result;
3477 ::new (&result.rotate3_d._0) (Number)(_0);
3478 ::new (&result.rotate3_d._1) (Number)(_1);
3479 ::new (&result.rotate3_d._2) (Number)(_2);
3480 ::new (&result.rotate3_d._3) (Angle)(_3);
3481 result.tag = Tag::Rotate3D;
3482 return result;
3483 }
3484
3485 bool IsRotate3D() const {
3486 return tag == Tag::Rotate3D;
3487 }
3488
3489 const StyleRotate3D_Body& AsRotate3D() const {
3490 MOZ_DIAGNOSTIC_ASSERT(IsRotate3D())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRotate3D())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRotate3D()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsRotate3D()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3490); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRotate3D()"
")"); do { *((volatile int*)__null) = 3490; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3491 return rotate3_d;
3492 }
3493
3494 static StyleGenericTransformOperation Perspective(const StyleGenericPerspectiveFunction<Length> &_0) {
3495 StyleGenericTransformOperation result;
3496 ::new (&result.perspective._0) (StyleGenericPerspectiveFunction<Length>)(_0);
3497 result.tag = Tag::Perspective;
3498 return result;
3499 }
3500
3501 bool IsPerspective() const {
3502 return tag == Tag::Perspective;
3503 }
3504
3505 const StyleGenericPerspectiveFunction<Length>& AsPerspective() const {
3506 MOZ_DIAGNOSTIC_ASSERT(IsPerspective())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPerspective())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPerspective()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPerspective()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3506); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPerspective()"
")"); do { *((volatile int*)__null) = 3506; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3507 return perspective._0;
3508 }
3509
3510 static StyleGenericTransformOperation InterpolateMatrix(const StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>> &from_list,
3511 const StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>> &to_list,
3512 const StylePercentage &progress) {
3513 StyleGenericTransformOperation result;
3514 ::new (&result.interpolate_matrix.from_list) (StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>)(from_list);
3515 ::new (&result.interpolate_matrix.to_list) (StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>)(to_list);
3516 ::new (&result.interpolate_matrix.progress) (StylePercentage)(progress);
3517 result.tag = Tag::InterpolateMatrix;
3518 return result;
3519 }
3520
3521 bool IsInterpolateMatrix() const {
3522 return tag == Tag::InterpolateMatrix;
3523 }
3524
3525 const StyleInterpolateMatrix_Body& AsInterpolateMatrix() const {
3526 MOZ_DIAGNOSTIC_ASSERT(IsInterpolateMatrix())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsInterpolateMatrix())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsInterpolateMatrix()))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("IsInterpolateMatrix()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3526); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsInterpolateMatrix()"
")"); do { *((volatile int*)__null) = 3526; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3527 return interpolate_matrix;
3528 }
3529
3530 static StyleGenericTransformOperation AccumulateMatrix(const StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>> &from_list,
3531 const StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>> &to_list,
3532 const Integer &count) {
3533 StyleGenericTransformOperation result;
3534 ::new (&result.accumulate_matrix.from_list) (StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>)(from_list);
3535 ::new (&result.accumulate_matrix.to_list) (StyleGenericTransform<StyleGenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>)(to_list);
3536 ::new (&result.accumulate_matrix.count) (Integer)(count);
3537 result.tag = Tag::AccumulateMatrix;
3538 return result;
3539 }
3540
3541 bool IsAccumulateMatrix() const {
3542 return tag == Tag::AccumulateMatrix;
3543 }
3544
3545 const StyleAccumulateMatrix_Body& AsAccumulateMatrix() const {
3546 MOZ_DIAGNOSTIC_ASSERT(IsAccumulateMatrix())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAccumulateMatrix())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAccumulateMatrix()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsAccumulateMatrix()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3546); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAccumulateMatrix()"
")"); do { *((volatile int*)__null) = 3546; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3547 return accumulate_matrix;
3548 }
3549
3550 bool operator==(const StyleGenericTransformOperation& other) const {
3551 if (tag != other.tag) {
3552 return false;
3553 }
3554 switch (tag) {
3555 case Tag::Matrix: return matrix == other.matrix;
3556 case Tag::Matrix3D: return matrix3_d == other.matrix3_d;
3557 case Tag::Skew: return skew == other.skew;
3558 case Tag::SkewX: return skew_x == other.skew_x;
3559 case Tag::SkewY: return skew_y == other.skew_y;
3560 case Tag::Translate: return translate == other.translate;
3561 case Tag::TranslateX: return translate_x == other.translate_x;
3562 case Tag::TranslateY: return translate_y == other.translate_y;
3563 case Tag::TranslateZ: return translate_z == other.translate_z;
3564 case Tag::Translate3D: return translate3_d == other.translate3_d;
3565 case Tag::Scale: return scale == other.scale;
3566 case Tag::ScaleX: return scale_x == other.scale_x;
3567 case Tag::ScaleY: return scale_y == other.scale_y;
3568 case Tag::ScaleZ: return scale_z == other.scale_z;
3569 case Tag::Scale3D: return scale3_d == other.scale3_d;
3570 case Tag::Rotate: return rotate == other.rotate;
3571 case Tag::RotateX: return rotate_x == other.rotate_x;
3572 case Tag::RotateY: return rotate_y == other.rotate_y;
3573 case Tag::RotateZ: return rotate_z == other.rotate_z;
3574 case Tag::Rotate3D: return rotate3_d == other.rotate3_d;
3575 case Tag::Perspective: return perspective == other.perspective;
3576 case Tag::InterpolateMatrix: return interpolate_matrix == other.interpolate_matrix;
3577 case Tag::AccumulateMatrix: return accumulate_matrix == other.accumulate_matrix;
3578
3579 }
3580 return true;
3581 }
3582
3583 bool operator!=(const StyleGenericTransformOperation& other) const {
3584 return !(*this == other);
3585 }
3586
3587 private:
3588 StyleGenericTransformOperation() {
3589
3590 }
3591 public:
3592
3593
3594 ~StyleGenericTransformOperation() {
3595 switch (tag) {
3596 case Tag::Matrix: matrix.~StyleMatrix_Body(); break;
3597 case Tag::Matrix3D: matrix3_d.~StyleMatrix3D_Body(); break;
3598 case Tag::Skew: skew.~StyleSkew_Body(); break;
3599 case Tag::SkewX: skew_x.~StyleSkewX_Body(); break;
3600 case Tag::SkewY: skew_y.~StyleSkewY_Body(); break;
3601 case Tag::Translate: translate.~StyleTranslate_Body(); break;
3602 case Tag::TranslateX: translate_x.~StyleTranslateX_Body(); break;
3603 case Tag::TranslateY: translate_y.~StyleTranslateY_Body(); break;
3604 case Tag::TranslateZ: translate_z.~StyleTranslateZ_Body(); break;
3605 case Tag::Translate3D: translate3_d.~StyleTranslate3D_Body(); break;
3606 case Tag::Scale: scale.~StyleScale_Body(); break;
3607 case Tag::ScaleX: scale_x.~StyleScaleX_Body(); break;
3608 case Tag::ScaleY: scale_y.~StyleScaleY_Body(); break;
3609 case Tag::ScaleZ: scale_z.~StyleScaleZ_Body(); break;
3610 case Tag::Scale3D: scale3_d.~StyleScale3D_Body(); break;
3611 case Tag::Rotate: rotate.~StyleRotate_Body(); break;
3612 case Tag::RotateX: rotate_x.~StyleRotateX_Body(); break;
3613 case Tag::RotateY: rotate_y.~StyleRotateY_Body(); break;
3614 case Tag::RotateZ: rotate_z.~StyleRotateZ_Body(); break;
3615 case Tag::Rotate3D: rotate3_d.~StyleRotate3D_Body(); break;
3616 case Tag::Perspective: perspective.~StylePerspective_Body(); break;
3617 case Tag::InterpolateMatrix: interpolate_matrix.~StyleInterpolateMatrix_Body(); break;
3618 case Tag::AccumulateMatrix: accumulate_matrix.~StyleAccumulateMatrix_Body(); break;
3619
3620 }
3621 }
3622
3623 StyleGenericTransformOperation(const StyleGenericTransformOperation& other)
3624 : tag(other.tag) {
3625 switch (tag) {
3626 case Tag::Matrix: ::new (&matrix) (StyleMatrix_Body)(other.matrix); break;
3627 case Tag::Matrix3D: ::new (&matrix3_d) (StyleMatrix3D_Body)(other.matrix3_d); break;
3628 case Tag::Skew: ::new (&skew) (StyleSkew_Body)(other.skew); break;
3629 case Tag::SkewX: ::new (&skew_x) (StyleSkewX_Body)(other.skew_x); break;
3630 case Tag::SkewY: ::new (&skew_y) (StyleSkewY_Body)(other.skew_y); break;
3631 case Tag::Translate: ::new (&translate) (StyleTranslate_Body)(other.translate); break;
3632 case Tag::TranslateX: ::new (&translate_x) (StyleTranslateX_Body)(other.translate_x); break;
3633 case Tag::TranslateY: ::new (&translate_y) (StyleTranslateY_Body)(other.translate_y); break;
3634 case Tag::TranslateZ: ::new (&translate_z) (StyleTranslateZ_Body)(other.translate_z); break;
3635 case Tag::Translate3D: ::new (&translate3_d) (StyleTranslate3D_Body)(other.translate3_d); break;
3636 case Tag::Scale: ::new (&scale) (StyleScale_Body)(other.scale); break;
3637 case Tag::ScaleX: ::new (&scale_x) (StyleScaleX_Body)(other.scale_x); break;
3638 case Tag::ScaleY: ::new (&scale_y) (StyleScaleY_Body)(other.scale_y); break;
3639 case Tag::ScaleZ: ::new (&scale_z) (StyleScaleZ_Body)(other.scale_z); break;
3640 case Tag::Scale3D: ::new (&scale3_d) (StyleScale3D_Body)(other.scale3_d); break;
3641 case Tag::Rotate: ::new (&rotate) (StyleRotate_Body)(other.rotate); break;
3642 case Tag::RotateX: ::new (&rotate_x) (StyleRotateX_Body)(other.rotate_x); break;
3643 case Tag::RotateY: ::new (&rotate_y) (StyleRotateY_Body)(other.rotate_y); break;
3644 case Tag::RotateZ: ::new (&rotate_z) (StyleRotateZ_Body)(other.rotate_z); break;
3645 case Tag::Rotate3D: ::new (&rotate3_d) (StyleRotate3D_Body)(other.rotate3_d); break;
3646 case Tag::Perspective: ::new (&perspective) (StylePerspective_Body)(other.perspective); break;
3647 case Tag::InterpolateMatrix: ::new (&interpolate_matrix) (StyleInterpolateMatrix_Body)(other.interpolate_matrix); break;
3648 case Tag::AccumulateMatrix: ::new (&accumulate_matrix) (StyleAccumulateMatrix_Body)(other.accumulate_matrix); break;
3649
3650 }
3651 }
3652 StyleGenericTransformOperation& operator=(const StyleGenericTransformOperation& other) {
3653 if (this != &other) {
3654 this->~StyleGenericTransformOperation();
3655 new (this) StyleGenericTransformOperation(other);
3656 }
3657 return *this;
3658 }
3659};
3660
3661/// A single operation in a computed CSS `transform`
3662using StyleTransformOperation = StyleGenericTransformOperation<StyleAngle, StyleNumber, StyleLength, StyleInteger, StyleLengthPercentage>;
3663
3664/// A computed CSS `transform`
3665using StyleTransform = StyleGenericTransform<StyleTransformOperation>;
3666
3667/// The computed value of a CSS horizontal position.
3668using StyleHorizontalPosition = StyleLengthPercentage;
3669
3670/// The computed value of a CSS vertical position.
3671using StyleVerticalPosition = StyleLengthPercentage;
3672
3673/// A generic type for representing a CSS [position](https://drafts.csswg.org/css-values/#position).
3674template<typename H, typename V>
3675struct StyleGenericPosition {
3676 /// The horizontal component of position.
3677 H horizontal;
3678 /// The vertical component of position.
3679 V vertical;
3680
3681 bool operator==(const StyleGenericPosition& other) const {
3682 return horizontal == other.horizontal &&
3683 vertical == other.vertical;
3684 }
3685 bool operator!=(const StyleGenericPosition& other) const {
3686 return horizontal != other.horizontal ||
3687 vertical != other.vertical;
3688 }
3689 inline bool HasPercent() const;
3690 inline bool DependsOnPositioningAreaSize() const;
3691 static inline StyleGenericPosition FromPercentage(float);
3692};
3693
3694/// The computed value of a CSS `<position>`
3695using StylePosition = StyleGenericPosition<StyleHorizontalPosition, StyleVerticalPosition>;
3696
3697/// A wrapper of Non-negative values.
3698template<typename T>
3699using StyleNonNegative = T;
3700
3701/// A wrapper of LengthPercentage, whose value must be >= 0.
3702using StyleNonNegativeLengthPercentage = StyleNonNegative<StyleLengthPercentage>;
3703
3704/// A CSS value made of four components, where its `ToCss` impl will try to
3705/// serialize as few components as possible, like for example in `border-width`.
3706template<typename T>
3707struct StyleRect {
3708 T _0;
3709 T _1;
3710 T _2;
3711 T _3;
3712
3713 bool operator==(const StyleRect& other) const {
3714 return _0 == other._0 &&
3715 _1 == other._1 &&
3716 _2 == other._2 &&
3717 _3 == other._3;
3718 }
3719 bool operator!=(const StyleRect& other) const {
3720 return _0 != other._0 ||
3721 _1 != other._1 ||
3722 _2 != other._2 ||
3723 _3 != other._3;
3724 }
3725 template<typename Predicate> inline bool All(Predicate) const;
3726 template<typename Predicate> inline bool Any(Predicate) const;
3727
3728 // Defined in WritingModes.h
3729 inline const T& Get(mozilla::Side) const;
3730 inline const T& Get(LogicalSide, WritingMode) const;
3731 inline const T& GetIStart(WritingMode) const;
3732 inline const T& GetBStart(WritingMode) const;
3733 inline const T& Start(LogicalAxis, WritingMode) const;
3734 inline const T& GetIEnd(WritingMode) const;
3735 inline const T& GetBEnd(WritingMode) const;
3736 inline const T& End(LogicalAxis, WritingMode) const;
3737
3738 inline T& Get(mozilla::Side);
3739 inline T& Get(LogicalSide, WritingMode);
3740 inline T& GetIStart(WritingMode);
3741 inline T& GetBStart(WritingMode);
3742 inline T& GetIEnd(WritingMode);
3743 inline T& GetBEnd(WritingMode);
3744
3745 static StyleRect WithAllSides(const T& aSide) {
3746 return {aSide, aSide, aSide, aSide};
3747 }
3748};
3749
3750/// A generic size, for `border-*-radius` longhand properties, or
3751/// `border-spacing`.
3752template<typename L>
3753struct StyleSize2D {
3754 L width;
3755 L height;
3756
3757 bool operator==(const StyleSize2D& other) const {
3758 return width == other.width &&
3759 height == other.height;
3760 }
3761 bool operator!=(const StyleSize2D& other) const {
3762 return width != other.width ||
3763 height != other.height;
3764 }
3765};
3766
3767/// A generic value for the `border-*-radius` longhand properties.
3768template<typename L>
3769struct StyleGenericBorderCornerRadius {
3770 StyleSize2D<L> _0;
3771
3772 bool operator==(const StyleGenericBorderCornerRadius& other) const {
3773 return _0 == other._0;
3774 }
3775 bool operator!=(const StyleGenericBorderCornerRadius& other) const {
3776 return _0 != other._0;
3777 }
3778};
3779
3780/// A generic value for `border-radius` and `inset()`.
3781///
3782/// <https://drafts.csswg.org/css-backgrounds-3/#border-radius>
3783template<typename LengthPercentage>
3784struct StyleGenericBorderRadius {
3785 /// The top left radius.
3786 StyleGenericBorderCornerRadius<LengthPercentage> top_left;
3787 /// The top right radius.
3788 StyleGenericBorderCornerRadius<LengthPercentage> top_right;
3789 /// The bottom right radius.
3790 StyleGenericBorderCornerRadius<LengthPercentage> bottom_right;
3791 /// The bottom left radius.
3792 StyleGenericBorderCornerRadius<LengthPercentage> bottom_left;
3793
3794 bool operator==(const StyleGenericBorderRadius& other) const {
3795 return top_left == other.top_left &&
3796 top_right == other.top_right &&
3797 bottom_right == other.bottom_right &&
3798 bottom_left == other.bottom_left;
3799 }
3800 bool operator!=(const StyleGenericBorderRadius& other) const {
3801 return top_left != other.top_left ||
3802 top_right != other.top_right ||
3803 bottom_right != other.bottom_right ||
3804 bottom_left != other.bottom_left;
3805 }
3806 inline const StyleLengthPercentage& Get(HalfCorner) const;
3807};
3808
3809/// <https://drafts.csswg.org/css-shapes/#funcdef-inset>
3810template<typename LengthPercentage, typename NonNegativeLengthPercentage>
3811struct StyleGenericInsetRect {
3812 StyleRect<LengthPercentage> rect;
3813 StyleGenericBorderRadius<NonNegativeLengthPercentage> round;
3814
3815 bool operator==(const StyleGenericInsetRect& other) const {
3816 return rect == other.rect &&
3817 round == other.round;
3818 }
3819 bool operator!=(const StyleGenericInsetRect& other) const {
3820 return rect != other.rect ||
3821 round != other.round;
3822 }
3823};
3824
3825/// The computed value of `inset()`.
3826using StyleInsetRect = StyleGenericInsetRect<StyleLengthPercentage, StyleNonNegativeLengthPercentage>;
3827
3828/// A generic type for representing an `Auto | <position>`.
3829/// This is used by <offset-anchor> for now.
3830/// https://drafts.fxtf.org/motion-1/#offset-anchor-property
3831template<typename Pos>
3832struct StyleGenericPositionOrAuto {
3833 enum class Tag : uint8_t {
3834 /// The <position> value.
3835 Position,
3836 /// The keyword `auto`.
3837 Auto,
3838 };
3839
3840 struct StylePosition_Body {
3841 Pos _0;
3842
3843 bool operator==(const StylePosition_Body& other) const {
3844 return _0 == other._0;
3845 }
3846 bool operator!=(const StylePosition_Body& other) const {
3847 return _0 != other._0;
3848 }
3849 };
3850
3851 Tag tag;
3852 union {
3853 StylePosition_Body position;
3854 };
3855
3856 static StyleGenericPositionOrAuto Position(const Pos &_0) {
3857 StyleGenericPositionOrAuto result;
3858 ::new (&result.position._0) (Pos)(_0);
3859 result.tag = Tag::Position;
3860 return result;
3861 }
3862
3863 bool IsPosition() const {
3864 return tag == Tag::Position;
3865 }
3866
3867 const Pos& AsPosition() const {
3868 MOZ_DIAGNOSTIC_ASSERT(IsPosition())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPosition())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPosition()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsPosition()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3868); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPosition()"
")"); do { *((volatile int*)__null) = 3868; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3869 return position._0;
3870 }
3871
3872 static StyleGenericPositionOrAuto Auto() {
3873 StyleGenericPositionOrAuto result;
3874 result.tag = Tag::Auto;
3875 return result;
3876 }
3877
3878 bool IsAuto() const {
3879 return tag == Tag::Auto;
3880 }
3881
3882 bool operator==(const StyleGenericPositionOrAuto& other) const {
3883 if (tag != other.tag) {
3884 return false;
3885 }
3886 switch (tag) {
3887 case Tag::Position: return position == other.position;
3888 default: break;
3889 }
3890 return true;
3891 }
3892
3893 bool operator!=(const StyleGenericPositionOrAuto& other) const {
3894 return !(*this == other);
3895 }
3896
3897 private:
3898 StyleGenericPositionOrAuto() {
3899
3900 }
3901 public:
3902
3903
3904 ~StyleGenericPositionOrAuto() {
3905 switch (tag) {
3906 case Tag::Position: position.~StylePosition_Body(); break;
3907 default: break;
3908 }
3909 }
3910
3911 StyleGenericPositionOrAuto(const StyleGenericPositionOrAuto& other)
3912 : tag(other.tag) {
3913 switch (tag) {
3914 case Tag::Position: ::new (&position) (StylePosition_Body)(other.position); break;
3915 default: break;
3916 }
3917 }
3918 StyleGenericPositionOrAuto& operator=(const StyleGenericPositionOrAuto& other) {
3919 if (this != &other) {
3920 this->~StyleGenericPositionOrAuto();
3921 new (this) StyleGenericPositionOrAuto(other);
3922 }
3923 return *this;
3924 }
3925};
3926
3927/// <https://drafts.csswg.org/css-shapes/#typedef-shape-radius>
3928template<typename NonNegativeLengthPercentage>
3929struct StyleGenericShapeRadius {
3930 enum class Tag : uint8_t {
3931 Length,
3932 ClosestSide,
3933 FarthestSide,
3934 };
3935
3936 struct StyleLength_Body {
3937 NonNegativeLengthPercentage _0;
3938
3939 bool operator==(const StyleLength_Body& other) const {
3940 return _0 == other._0;
3941 }
3942 bool operator!=(const StyleLength_Body& other) const {
3943 return _0 != other._0;
3944 }
3945 };
3946
3947 Tag tag;
3948 union {
3949 StyleLength_Body length;
3950 };
3951
3952 static StyleGenericShapeRadius Length(const NonNegativeLengthPercentage &_0) {
3953 StyleGenericShapeRadius result;
3954 ::new (&result.length._0) (NonNegativeLengthPercentage)(_0);
3955 result.tag = Tag::Length;
3956 return result;
3957 }
3958
3959 bool IsLength() const {
3960 return tag == Tag::Length;
3961 }
3962
3963 const NonNegativeLengthPercentage& AsLength() const {
3964 MOZ_DIAGNOSTIC_ASSERT(IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLength()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 3964); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLength()"
")"); do { *((volatile int*)__null) = 3964; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
3965 return length._0;
3966 }
3967
3968 static StyleGenericShapeRadius ClosestSide() {
3969 StyleGenericShapeRadius result;
3970 result.tag = Tag::ClosestSide;
3971 return result;
3972 }
3973
3974 bool IsClosestSide() const {
3975 return tag == Tag::ClosestSide;
3976 }
3977
3978 static StyleGenericShapeRadius FarthestSide() {
3979 StyleGenericShapeRadius result;
3980 result.tag = Tag::FarthestSide;
3981 return result;
3982 }
3983
3984 bool IsFarthestSide() const {
3985 return tag == Tag::FarthestSide;
3986 }
3987
3988 bool operator==(const StyleGenericShapeRadius& other) const {
3989 if (tag != other.tag) {
3990 return false;
3991 }
3992 switch (tag) {
3993 case Tag::Length: return length == other.length;
3994 default: break;
3995 }
3996 return true;
3997 }
3998
3999 bool operator!=(const StyleGenericShapeRadius& other) const {
4000 return !(*this == other);
4001 }
4002
4003 private:
4004 StyleGenericShapeRadius() {
4005
4006 }
4007 public:
4008
4009
4010 ~StyleGenericShapeRadius() {
4011 switch (tag) {
4012 case Tag::Length: length.~StyleLength_Body(); break;
4013 default: break;
4014 }
4015 }
4016
4017 StyleGenericShapeRadius(const StyleGenericShapeRadius& other)
4018 : tag(other.tag) {
4019 switch (tag) {
4020 case Tag::Length: ::new (&length) (StyleLength_Body)(other.length); break;
4021 default: break;
4022 }
4023 }
4024 StyleGenericShapeRadius& operator=(const StyleGenericShapeRadius& other) {
4025 if (this != &other) {
4026 this->~StyleGenericShapeRadius();
4027 new (this) StyleGenericShapeRadius(other);
4028 }
4029 return *this;
4030 }
4031};
4032
4033/// <https://drafts.csswg.org/css-shapes/#funcdef-circle>
4034template<typename Position, typename NonNegativeLengthPercentage>
4035struct StyleCircle {
4036 StyleGenericPositionOrAuto<Position> position;
4037 StyleGenericShapeRadius<NonNegativeLengthPercentage> radius;
4038
4039 bool operator==(const StyleCircle& other) const {
4040 return position == other.position &&
4041 radius == other.radius;
4042 }
4043 bool operator!=(const StyleCircle& other) const {
4044 return position != other.position ||
4045 radius != other.radius;
4046 }
4047};
4048
4049/// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse>
4050template<typename Position, typename NonNegativeLengthPercentage>
4051struct StyleEllipse {
4052 StyleGenericPositionOrAuto<Position> position;
4053 StyleGenericShapeRadius<NonNegativeLengthPercentage> semiaxis_x;
4054 StyleGenericShapeRadius<NonNegativeLengthPercentage> semiaxis_y;
4055
4056 bool operator==(const StyleEllipse& other) const {
4057 return position == other.position &&
4058 semiaxis_x == other.semiaxis_x &&
4059 semiaxis_y == other.semiaxis_y;
4060 }
4061 bool operator!=(const StyleEllipse& other) const {
4062 return position != other.position ||
4063 semiaxis_x != other.semiaxis_x ||
4064 semiaxis_y != other.semiaxis_y;
4065 }
4066};
4067
4068/// Coordinates for Polygon.
4069template<typename LengthPercentage>
4070struct StylePolygonCoord {
4071 LengthPercentage _0;
4072 LengthPercentage _1;
4073
4074 bool operator==(const StylePolygonCoord& other) const {
4075 return _0 == other._0 &&
4076 _1 == other._1;
4077 }
4078 bool operator!=(const StylePolygonCoord& other) const {
4079 return _0 != other._0 ||
4080 _1 != other._1;
4081 }
4082};
4083
4084/// A generic type for representing the `polygon()` function
4085///
4086/// <https://drafts.csswg.org/css-shapes/#funcdef-polygon>
4087template<typename LengthPercentage>
4088struct StyleGenericPolygon {
4089 /// The filling rule for a polygon.
4090 StyleFillRule fill;
4091 /// A collection of (x, y) coordinates to draw the polygon.
4092 StyleOwnedSlice<StylePolygonCoord<LengthPercentage>> coordinates;
4093
4094 bool operator==(const StyleGenericPolygon& other) const {
4095 return fill == other.fill &&
4096 coordinates == other.coordinates;
4097 }
4098 bool operator!=(const StyleGenericPolygon& other) const {
4099 return fill != other.fill ||
4100 coordinates != other.coordinates;
4101 }
4102};
4103
4104/// Defines a pair of coordinates, representing a rightward and downward offset, respectively, from
4105/// a specified reference point. Percentages are resolved against the width or height,
4106/// respectively, of the reference box.
4107/// https://drafts.csswg.org/css-shapes-2/#typedef-shape-coordinate-pair
4108template<typename LengthPercentage>
4109struct StyleCoordinatePair {
4110 LengthPercentage x;
4111 LengthPercentage y;
4112
4113 bool operator==(const StyleCoordinatePair& other) const {
4114 return x == other.x &&
4115 y == other.y;
4116 }
4117 bool operator!=(const StyleCoordinatePair& other) const {
4118 return x != other.x ||
4119 y != other.y;
4120 }
4121 inline gfx::Point ToGfxPoint(const CSSSize* aBasis = nullptr) const;
4122 gfx::Point ToGfxPoint(const CSSSize& aBasis) const {
4123 return ToGfxPoint(&aBasis);
4124 };
4125};
4126
4127/// This is a more general shape(path) command type, for both shape() and path().
4128///
4129/// https://www.w3.org/TR/SVG11/paths.html#PathData
4130/// https://drafts.csswg.org/css-shapes-2/#shape-function
4131template<typename Angle, typename LengthPercentage>
4132struct StyleGenericShapeCommand {
4133 enum class Tag : uint8_t {
4134 /// The move command.
4135 Move,
4136 /// The line command.
4137 Line,
4138 /// The hline command.
4139 HLine,
4140 /// The vline command.
4141 VLine,
4142 /// The cubic Bézier curve command.
4143 CubicCurve,
4144 /// The quadratic Bézier curve command.
4145 QuadCurve,
4146 /// The smooth command.
4147 SmoothCubic,
4148 /// The smooth quadratic Bézier curve command.
4149 SmoothQuad,
4150 /// The arc command.
4151 Arc,
4152 /// The closepath command.
4153 Close,
4154 };
4155
4156 struct StyleMove_Body {
4157 StyleByTo by_to;
4158 StyleCoordinatePair<LengthPercentage> point;
4159
4160 bool operator==(const StyleMove_Body& other) const {
4161 return by_to == other.by_to &&
4162 point == other.point;
4163 }
4164 bool operator!=(const StyleMove_Body& other) const {
4165 return by_to != other.by_to ||
4166 point != other.point;
4167 }
4168 };
4169
4170 struct StyleLine_Body {
4171 StyleByTo by_to;
4172 StyleCoordinatePair<LengthPercentage> point;
4173
4174 bool operator==(const StyleLine_Body& other) const {
4175 return by_to == other.by_to &&
4176 point == other.point;
4177 }
4178 bool operator!=(const StyleLine_Body& other) const {
4179 return by_to != other.by_to ||
4180 point != other.point;
4181 }
4182 };
4183
4184 struct StyleHLine_Body {
4185 StyleByTo by_to;
4186 LengthPercentage x;
4187
4188 bool operator==(const StyleHLine_Body& other) const {
4189 return by_to == other.by_to &&
4190 x == other.x;
4191 }
4192 bool operator!=(const StyleHLine_Body& other) const {
4193 return by_to != other.by_to ||
4194 x != other.x;
4195 }
4196 };
4197
4198 struct StyleVLine_Body {
4199 StyleByTo by_to;
4200 LengthPercentage y;
4201
4202 bool operator==(const StyleVLine_Body& other) const {
4203 return by_to == other.by_to &&
4204 y == other.y;
4205 }
4206 bool operator!=(const StyleVLine_Body& other) const {
4207 return by_to != other.by_to ||
4208 y != other.y;
4209 }
4210 };
4211
4212 struct StyleCubicCurve_Body {
4213 StyleByTo by_to;
4214 StyleCoordinatePair<LengthPercentage> point;
4215 StyleCoordinatePair<LengthPercentage> control1;
4216 StyleCoordinatePair<LengthPercentage> control2;
4217
4218 bool operator==(const StyleCubicCurve_Body& other) const {
4219 return by_to == other.by_to &&
4220 point == other.point &&
4221 control1 == other.control1 &&
4222 control2 == other.control2;
4223 }
4224 bool operator!=(const StyleCubicCurve_Body& other) const {
4225 return by_to != other.by_to ||
4226 point != other.point ||
4227 control1 != other.control1 ||
4228 control2 != other.control2;
4229 }
4230 };
4231
4232 struct StyleQuadCurve_Body {
4233 StyleByTo by_to;
4234 StyleCoordinatePair<LengthPercentage> point;
4235 StyleCoordinatePair<LengthPercentage> control1;
4236
4237 bool operator==(const StyleQuadCurve_Body& other) const {
4238 return by_to == other.by_to &&
4239 point == other.point &&
4240 control1 == other.control1;
4241 }
4242 bool operator!=(const StyleQuadCurve_Body& other) const {
4243 return by_to != other.by_to ||
4244 point != other.point ||
4245 control1 != other.control1;
4246 }
4247 };
4248
4249 struct StyleSmoothCubic_Body {
4250 StyleByTo by_to;
4251 StyleCoordinatePair<LengthPercentage> point;
4252 StyleCoordinatePair<LengthPercentage> control2;
4253
4254 bool operator==(const StyleSmoothCubic_Body& other) const {
4255 return by_to == other.by_to &&
4256 point == other.point &&
4257 control2 == other.control2;
4258 }
4259 bool operator!=(const StyleSmoothCubic_Body& other) const {
4260 return by_to != other.by_to ||
4261 point != other.point ||
4262 control2 != other.control2;
4263 }
4264 };
4265
4266 struct StyleSmoothQuad_Body {
4267 StyleByTo by_to;
4268 StyleCoordinatePair<LengthPercentage> point;
4269
4270 bool operator==(const StyleSmoothQuad_Body& other) const {
4271 return by_to == other.by_to &&
4272 point == other.point;
4273 }
4274 bool operator!=(const StyleSmoothQuad_Body& other) const {
4275 return by_to != other.by_to ||
4276 point != other.point;
4277 }
4278 };
4279
4280 struct StyleArc_Body {
4281 StyleByTo by_to;
4282 StyleCoordinatePair<LengthPercentage> point;
4283 StyleCoordinatePair<LengthPercentage> radii;
4284 StyleArcSweep arc_sweep;
4285 StyleArcSize arc_size;
4286 Angle rotate;
4287
4288 bool operator==(const StyleArc_Body& other) const {
4289 return by_to == other.by_to &&
4290 point == other.point &&
4291 radii == other.radii &&
4292 arc_sweep == other.arc_sweep &&
4293 arc_size == other.arc_size &&
4294 rotate == other.rotate;
4295 }
4296 bool operator!=(const StyleArc_Body& other) const {
4297 return by_to != other.by_to ||
4298 point != other.point ||
4299 radii != other.radii ||
4300 arc_sweep != other.arc_sweep ||
4301 arc_size != other.arc_size ||
4302 rotate != other.rotate;
4303 }
4304 };
4305
4306 Tag tag;
4307 union {
4308 StyleMove_Body move;
4309 StyleLine_Body line;
4310 StyleHLine_Body h_line;
4311 StyleVLine_Body v_line;
4312 StyleCubicCurve_Body cubic_curve;
4313 StyleQuadCurve_Body quad_curve;
4314 StyleSmoothCubic_Body smooth_cubic;
4315 StyleSmoothQuad_Body smooth_quad;
4316 StyleArc_Body arc;
4317 };
4318
4319 static StyleGenericShapeCommand Move(const StyleByTo &by_to,
4320 const StyleCoordinatePair<LengthPercentage> &point) {
4321 StyleGenericShapeCommand result;
4322 ::new (&result.move.by_to) (StyleByTo)(by_to);
4323 ::new (&result.move.point) (StyleCoordinatePair<LengthPercentage>)(point);
4324 result.tag = Tag::Move;
4325 return result;
4326 }
4327
4328 bool IsMove() const {
4329 return tag == Tag::Move;
4330 }
4331
4332 const StyleMove_Body& AsMove() const {
4333 MOZ_DIAGNOSTIC_ASSERT(IsMove())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsMove())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsMove()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsMove()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4333); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsMove()"
")"); do { *((volatile int*)__null) = 4333; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4334 return move;
4335 }
4336
4337 static StyleGenericShapeCommand Line(const StyleByTo &by_to,
4338 const StyleCoordinatePair<LengthPercentage> &point) {
4339 StyleGenericShapeCommand result;
4340 ::new (&result.line.by_to) (StyleByTo)(by_to);
4341 ::new (&result.line.point) (StyleCoordinatePair<LengthPercentage>)(point);
4342 result.tag = Tag::Line;
4343 return result;
4344 }
4345
4346 bool IsLine() const {
4347 return tag == Tag::Line;
4348 }
4349
4350 const StyleLine_Body& AsLine() const {
4351 MOZ_DIAGNOSTIC_ASSERT(IsLine())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLine())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLine()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLine()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4351); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLine()"
")"); do { *((volatile int*)__null) = 4351; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4352 return line;
4353 }
4354
4355 static StyleGenericShapeCommand HLine(const StyleByTo &by_to,
4356 const LengthPercentage &x) {
4357 StyleGenericShapeCommand result;
4358 ::new (&result.h_line.by_to) (StyleByTo)(by_to);
4359 ::new (&result.h_line.x) (LengthPercentage)(x);
4360 result.tag = Tag::HLine;
4361 return result;
4362 }
4363
4364 bool IsHLine() const {
4365 return tag == Tag::HLine;
4366 }
4367
4368 const StyleHLine_Body& AsHLine() const {
4369 MOZ_DIAGNOSTIC_ASSERT(IsHLine())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsHLine())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsHLine()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsHLine()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4369); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsHLine()"
")"); do { *((volatile int*)__null) = 4369; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4370 return h_line;
4371 }
4372
4373 static StyleGenericShapeCommand VLine(const StyleByTo &by_to,
4374 const LengthPercentage &y) {
4375 StyleGenericShapeCommand result;
4376 ::new (&result.v_line.by_to) (StyleByTo)(by_to);
4377 ::new (&result.v_line.y) (LengthPercentage)(y);
4378 result.tag = Tag::VLine;
4379 return result;
4380 }
4381
4382 bool IsVLine() const {
4383 return tag == Tag::VLine;
4384 }
4385
4386 const StyleVLine_Body& AsVLine() const {
4387 MOZ_DIAGNOSTIC_ASSERT(IsVLine())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsVLine())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsVLine()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsVLine()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4387); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsVLine()"
")"); do { *((volatile int*)__null) = 4387; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4388 return v_line;
4389 }
4390
4391 static StyleGenericShapeCommand CubicCurve(const StyleByTo &by_to,
4392 const StyleCoordinatePair<LengthPercentage> &point,
4393 const StyleCoordinatePair<LengthPercentage> &control1,
4394 const StyleCoordinatePair<LengthPercentage> &control2) {
4395 StyleGenericShapeCommand result;
4396 ::new (&result.cubic_curve.by_to) (StyleByTo)(by_to);
4397 ::new (&result.cubic_curve.point) (StyleCoordinatePair<LengthPercentage>)(point);
4398 ::new (&result.cubic_curve.control1) (StyleCoordinatePair<LengthPercentage>)(control1);
4399 ::new (&result.cubic_curve.control2) (StyleCoordinatePair<LengthPercentage>)(control2);
4400 result.tag = Tag::CubicCurve;
4401 return result;
4402 }
4403
4404 bool IsCubicCurve() const {
4405 return tag == Tag::CubicCurve;
4406 }
4407
4408 const StyleCubicCurve_Body& AsCubicCurve() const {
4409 MOZ_DIAGNOSTIC_ASSERT(IsCubicCurve())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCubicCurve())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCubicCurve()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsCubicCurve()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4409); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCubicCurve()"
")"); do { *((volatile int*)__null) = 4409; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4410 return cubic_curve;
4411 }
4412
4413 static StyleGenericShapeCommand QuadCurve(const StyleByTo &by_to,
4414 const StyleCoordinatePair<LengthPercentage> &point,
4415 const StyleCoordinatePair<LengthPercentage> &control1) {
4416 StyleGenericShapeCommand result;
4417 ::new (&result.quad_curve.by_to) (StyleByTo)(by_to);
4418 ::new (&result.quad_curve.point) (StyleCoordinatePair<LengthPercentage>)(point);
4419 ::new (&result.quad_curve.control1) (StyleCoordinatePair<LengthPercentage>)(control1);
4420 result.tag = Tag::QuadCurve;
4421 return result;
4422 }
4423
4424 bool IsQuadCurve() const {
4425 return tag == Tag::QuadCurve;
4426 }
4427
4428 const StyleQuadCurve_Body& AsQuadCurve() const {
4429 MOZ_DIAGNOSTIC_ASSERT(IsQuadCurve())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsQuadCurve())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsQuadCurve()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsQuadCurve()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4429); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsQuadCurve()"
")"); do { *((volatile int*)__null) = 4429; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4430 return quad_curve;
4431 }
4432
4433 static StyleGenericShapeCommand SmoothCubic(const StyleByTo &by_to,
4434 const StyleCoordinatePair<LengthPercentage> &point,
4435 const StyleCoordinatePair<LengthPercentage> &control2) {
4436 StyleGenericShapeCommand result;
4437 ::new (&result.smooth_cubic.by_to) (StyleByTo)(by_to);
4438 ::new (&result.smooth_cubic.point) (StyleCoordinatePair<LengthPercentage>)(point);
4439 ::new (&result.smooth_cubic.control2) (StyleCoordinatePair<LengthPercentage>)(control2);
4440 result.tag = Tag::SmoothCubic;
4441 return result;
4442 }
4443
4444 bool IsSmoothCubic() const {
4445 return tag == Tag::SmoothCubic;
4446 }
4447
4448 const StyleSmoothCubic_Body& AsSmoothCubic() const {
4449 MOZ_DIAGNOSTIC_ASSERT(IsSmoothCubic())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSmoothCubic())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSmoothCubic()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsSmoothCubic()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4449); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSmoothCubic()"
")"); do { *((volatile int*)__null) = 4449; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4450 return smooth_cubic;
4451 }
4452
4453 static StyleGenericShapeCommand SmoothQuad(const StyleByTo &by_to,
4454 const StyleCoordinatePair<LengthPercentage> &point) {
4455 StyleGenericShapeCommand result;
4456 ::new (&result.smooth_quad.by_to) (StyleByTo)(by_to);
4457 ::new (&result.smooth_quad.point) (StyleCoordinatePair<LengthPercentage>)(point);
4458 result.tag = Tag::SmoothQuad;
4459 return result;
4460 }
4461
4462 bool IsSmoothQuad() const {
4463 return tag == Tag::SmoothQuad;
4464 }
4465
4466 const StyleSmoothQuad_Body& AsSmoothQuad() const {
4467 MOZ_DIAGNOSTIC_ASSERT(IsSmoothQuad())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSmoothQuad())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSmoothQuad()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsSmoothQuad()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4467); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSmoothQuad()"
")"); do { *((volatile int*)__null) = 4467; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4468 return smooth_quad;
4469 }
4470
4471 static StyleGenericShapeCommand Arc(const StyleByTo &by_to,
4472 const StyleCoordinatePair<LengthPercentage> &point,
4473 const StyleCoordinatePair<LengthPercentage> &radii,
4474 const StyleArcSweep &arc_sweep,
4475 const StyleArcSize &arc_size,
4476 const Angle &rotate) {
4477 StyleGenericShapeCommand result;
4478 ::new (&result.arc.by_to) (StyleByTo)(by_to);
4479 ::new (&result.arc.point) (StyleCoordinatePair<LengthPercentage>)(point);
4480 ::new (&result.arc.radii) (StyleCoordinatePair<LengthPercentage>)(radii);
4481 ::new (&result.arc.arc_sweep) (StyleArcSweep)(arc_sweep);
4482 ::new (&result.arc.arc_size) (StyleArcSize)(arc_size);
4483 ::new (&result.arc.rotate) (Angle)(rotate);
4484 result.tag = Tag::Arc;
4485 return result;
4486 }
4487
4488 bool IsArc() const {
4489 return tag == Tag::Arc;
4490 }
4491
4492 const StyleArc_Body& AsArc() const {
4493 MOZ_DIAGNOSTIC_ASSERT(IsArc())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsArc())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsArc()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsArc()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4493); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsArc()"
")"); do { *((volatile int*)__null) = 4493; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4494 return arc;
4495 }
4496
4497 static StyleGenericShapeCommand Close() {
4498 StyleGenericShapeCommand result;
4499 result.tag = Tag::Close;
4500 return result;
4501 }
4502
4503 bool IsClose() const {
4504 return tag == Tag::Close;
4505 }
4506
4507 bool operator==(const StyleGenericShapeCommand& other) const {
4508 if (tag != other.tag) {
4509 return false;
4510 }
4511 switch (tag) {
4512 case Tag::Move: return move == other.move;
4513 case Tag::Line: return line == other.line;
4514 case Tag::HLine: return h_line == other.h_line;
4515 case Tag::VLine: return v_line == other.v_line;
4516 case Tag::CubicCurve: return cubic_curve == other.cubic_curve;
4517 case Tag::QuadCurve: return quad_curve == other.quad_curve;
4518 case Tag::SmoothCubic: return smooth_cubic == other.smooth_cubic;
4519 case Tag::SmoothQuad: return smooth_quad == other.smooth_quad;
4520 case Tag::Arc: return arc == other.arc;
4521 default: break;
4522 }
4523 return true;
4524 }
4525
4526 bool operator!=(const StyleGenericShapeCommand& other) const {
4527 return !(*this == other);
4528 }
4529
4530 private:
4531 StyleGenericShapeCommand() {
4532
4533 }
4534 public:
4535
4536
4537 ~StyleGenericShapeCommand() {
4538 switch (tag) {
4539 case Tag::Move: move.~StyleMove_Body(); break;
4540 case Tag::Line: line.~StyleLine_Body(); break;
4541 case Tag::HLine: h_line.~StyleHLine_Body(); break;
4542 case Tag::VLine: v_line.~StyleVLine_Body(); break;
4543 case Tag::CubicCurve: cubic_curve.~StyleCubicCurve_Body(); break;
4544 case Tag::QuadCurve: quad_curve.~StyleQuadCurve_Body(); break;
4545 case Tag::SmoothCubic: smooth_cubic.~StyleSmoothCubic_Body(); break;
4546 case Tag::SmoothQuad: smooth_quad.~StyleSmoothQuad_Body(); break;
4547 case Tag::Arc: arc.~StyleArc_Body(); break;
4548 default: break;
4549 }
4550 }
4551
4552 StyleGenericShapeCommand(const StyleGenericShapeCommand& other)
4553 : tag(other.tag) {
4554 switch (tag) {
4555 case Tag::Move: ::new (&move) (StyleMove_Body)(other.move); break;
4556 case Tag::Line: ::new (&line) (StyleLine_Body)(other.line); break;
4557 case Tag::HLine: ::new (&h_line) (StyleHLine_Body)(other.h_line); break;
4558 case Tag::VLine: ::new (&v_line) (StyleVLine_Body)(other.v_line); break;
4559 case Tag::CubicCurve: ::new (&cubic_curve) (StyleCubicCurve_Body)(other.cubic_curve); break;
4560 case Tag::QuadCurve: ::new (&quad_curve) (StyleQuadCurve_Body)(other.quad_curve); break;
4561 case Tag::SmoothCubic: ::new (&smooth_cubic) (StyleSmoothCubic_Body)(other.smooth_cubic); break;
4562 case Tag::SmoothQuad: ::new (&smooth_quad) (StyleSmoothQuad_Body)(other.smooth_quad); break;
4563 case Tag::Arc: ::new (&arc) (StyleArc_Body)(other.arc); break;
4564 default: break;
4565 }
4566 }
4567 StyleGenericShapeCommand& operator=(const StyleGenericShapeCommand& other) {
4568 if (this != &other) {
4569 this->~StyleGenericShapeCommand();
4570 new (this) StyleGenericShapeCommand(other);
4571 }
4572 return *this;
4573 }
4574 bool IsCubicType() const { return IsCubicCurve() || IsSmoothCubic(); }
4575 bool IsQuadraticType() const { return IsQuadCurve() || IsSmoothQuad(); }
4576};
4577
4578/// The SVG path command.
4579/// The fields of these commands are self-explanatory, so we skip the documents.
4580/// Note: the index of the control points, e.g. control1, control2, are mapping to the control
4581/// points of the Bézier curve in the spec.
4582///
4583/// https://www.w3.org/TR/SVG11/paths.html#PathData
4584using StylePathCommand = StyleGenericShapeCommand<StyleCSSFloat, StyleCSSFloat>;
4585
4586/// Structure to allow Arc-managing some fixed-sized data and a variably-sized
4587/// slice in a single allocation.
4588///
4589template<typename H, typename T>
4590struct StyleHeaderSlice {
4591 /// The fixed-sized data.
4592 H header;
4593 /// The length of the slice at our end.
4594 uintptr_t len;
4595 /// The dynamically-sized data.
4596 T data[0];
4597 StyleHeaderSlice() = delete;
4598 StyleHeaderSlice(const StyleHeaderSlice&) = delete;
4599
4600 inline ~StyleHeaderSlice();
4601 inline bool operator==(const StyleHeaderSlice& other) const;
4602 inline bool operator!=(const StyleHeaderSlice& other) const;
4603
4604 inline Span<const T> AsSpan() const;
4605 inline size_t Length() const { return len; }
4606 inline bool IsEmpty() const { return len == 0; }
4607};
4608
4609/// The object allocated by an Arc<T>
4610///
4611/// See https://github.com/mozilla/cbindgen/issues/937 for the derive-{eq,neq}=false. But we don't
4612/// use those anyways so we can just disable them.
4613template<typename T>
4614struct StyleArcInner {
4615 StyleAtomicUsize count;
4616#if defined(CBINDGEN_IS_SERVO)
4617 uintptr_t alloc_size
4618#endif
4619 ;
4620 T data;
4621 // Increase the reference count.
4622 inline void IncrementRef();
4623 // Release the reference count, and return whether the result must be freed or not.
4624 [[nodiscard]] inline bool DecrementRef();
4625};
4626
4627/// An atomically reference counted shared pointer
4628///
4629/// See the documentation for [`Arc`] in the standard library. Unlike the
4630/// standard library `Arc`, this `Arc` does not support weak reference counting.
4631///
4632/// See the discussion in https://github.com/rust-lang/rust/pull/60594 for the
4633/// usage of PhantomData.
4634///
4635/// [`Arc`]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html
4636///
4637template<typename T>
4638struct StyleArc {
4639 StyleArcInner<T> *p;
4640 StyleArc() = delete;
4641 inline StyleArc(const StyleArc& Other);
4642 private:
4643 inline void Release();
4644 public:
4645 explicit StyleArc(decltype(p) aP) : p(aP) {
4646 MOZ_DIAGNOSTIC_ASSERT(p, "Arc shouldn't be null")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(p)>::isValid, "invalid assertion condition"); if (
(__builtin_expect(!!(!(!!(p))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("p" " (" "Arc shouldn't be null" ")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4646); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "p"
") (" "Arc shouldn't be null" ")"); do { *((volatile int*)__null
) = 4646; __attribute__((nomerge)) ::abort(); } while (false)
; } } while (false)
;
4647 }
4648 inline ~StyleArc();
4649
4650 inline StyleArc& operator=(const StyleArc&);
4651 inline StyleArc& operator=(StyleArc&&);
4652
4653 const T* operator->() const {
4654 MOZ_DIAGNOSTIC_ASSERT(p, "Arc shouldn't be null")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(p)>::isValid, "invalid assertion condition"); if (
(__builtin_expect(!!(!(!!(p))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("p" " (" "Arc shouldn't be null" ")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4654); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "p"
") (" "Arc shouldn't be null" ")"); do { *((volatile int*)__null
) = 4654; __attribute__((nomerge)) ::abort(); } while (false)
; } } while (false)
;
4655 return &p->data;
4656 }
4657 const T& operator*() const {
4658 MOZ_DIAGNOSTIC_ASSERT(p, "Arc shouldn't be null")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(p)>::isValid, "invalid assertion condition"); if (
(__builtin_expect(!!(!(!!(p))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("p" " (" "Arc shouldn't be null" ")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4658); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "p"
") (" "Arc shouldn't be null" ")"); do { *((volatile int*)__null
) = 4658; __attribute__((nomerge)) ::abort(); } while (false)
; } } while (false)
;
4659 return p->data;
4660 }
4661 bool operator==(const StyleArc& other) const {
4662 return p == other.p || *(*this) == *other;
4663 }
4664 bool operator!=(const StyleArc& other) const {
4665 return !(*this == other);
4666 }
4667};
4668
4669/// This is functionally equivalent to Arc<(H, [T])>
4670///
4671/// When you create an `Arc` containing a dynamically sized type like a slice, the `Arc` is
4672/// represented on the stack as a "fat pointer", where the length of the slice is stored alongside
4673/// the `Arc`'s pointer. In some situations you may wish to have a thin pointer instead, perhaps
4674/// for FFI compatibility or space efficiency. `ThinArc` solves this by storing the length in the
4675/// allocation itself, via `HeaderSlice`.
4676template<typename H, typename T>
4677using StyleThinArc = StyleArc<StyleHeaderSlice<H, T>>;
4678
4679/// A wrapper type for a refcounted slice using ThinArc.
4680template<typename T>
4681struct StyleArcSlice {
4682 StyleThinArc<uint64_t, T> _0;
4683
4684 bool operator==(const StyleArcSlice& other) const {
4685 return _0 == other._0;
4686 }
4687 bool operator!=(const StyleArcSlice& other) const {
4688 return _0 != other._0;
4689 }
4690 inline StyleArcSlice();
4691 inline explicit StyleArcSlice(const StyleForgottenArcSlicePtr<T>& aPtr);
4692 inline Span<const T> AsSpan() const;
4693 inline size_t Length() const;
4694 inline bool IsEmpty() const;
4695};
4696
4697/// The SVG path data.
4698///
4699/// https://www.w3.org/TR/SVG11/paths.html#PathData
4700struct StyleSVGPathData {
4701 StyleArcSlice<StylePathCommand> _0;
4702
4703 bool operator==(const StyleSVGPathData& other) const {
4704 return _0 == other._0;
4705 }
4706 bool operator!=(const StyleSVGPathData& other) const {
4707 return _0 != other._0;
4708 }
4709};
4710
4711/// The path function.
4712///
4713/// https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-path
4714struct StylePath {
4715 /// The filling rule for the svg path.
4716 StyleFillRule fill;
4717 /// The svg path data.
4718 StyleSVGPathData path;
4719
4720 bool operator==(const StylePath& other) const {
4721 return fill == other.fill &&
4722 path == other.path;
4723 }
4724 bool operator!=(const StylePath& other) const {
4725 return fill != other.fill ||
4726 path != other.path;
4727 }
4728};
4729
4730/// The shape function defined in css-shape-2.
4731/// shape() = shape(<fill-rule>? from <coordinate-pair>, <shape-command>#)
4732///
4733/// https://drafts.csswg.org/css-shapes-2/#shape-function
4734template<typename Angle, typename LengthPercentage>
4735struct StyleShape {
4736 /// The filling rule for this shape.
4737 StyleFillRule fill;
4738 /// The shape command data. Note that the starting point will be the first command in this
4739 /// slice.
4740 StyleOwnedSlice<StyleGenericShapeCommand<Angle, LengthPercentage>> commands;
4741
4742 bool operator==(const StyleShape& other) const {
4743 return fill == other.fill &&
4744 commands == other.commands;
4745 }
4746 bool operator!=(const StyleShape& other) const {
4747 return fill != other.fill ||
4748 commands != other.commands;
4749 }
4750};
4751
4752/// path() function or shape() function.
4753template<typename Angle, typename LengthPercentage>
4754struct StyleGenericPathOrShapeFunction {
4755 enum class Tag : uint8_t {
4756 /// Defines a path with SVG path syntax.
4757 Path,
4758 /// Defines a shape function, which is identical to path() but it uses the CSS syntax.
4759 Shape,
4760 };
4761
4762 struct StylePath_Body {
4763 StylePath _0;
4764
4765 bool operator==(const StylePath_Body& other) const {
4766 return _0 == other._0;
4767 }
4768 bool operator!=(const StylePath_Body& other) const {
4769 return _0 != other._0;
4770 }
4771 };
4772
4773 struct StyleShape_Body {
4774 StyleShape<Angle, LengthPercentage> _0;
4775
4776 bool operator==(const StyleShape_Body& other) const {
4777 return _0 == other._0;
4778 }
4779 bool operator!=(const StyleShape_Body& other) const {
4780 return _0 != other._0;
4781 }
4782 };
4783
4784 Tag tag;
4785 union {
4786 StylePath_Body path;
4787 StyleShape_Body shape;
4788 };
4789
4790 static StyleGenericPathOrShapeFunction Path(const StylePath &_0) {
4791 StyleGenericPathOrShapeFunction result;
4792 ::new (&result.path._0) (StylePath)(_0);
4793 result.tag = Tag::Path;
4794 return result;
4795 }
4796
4797 bool IsPath() const {
4798 return tag == Tag::Path;
4799 }
4800
4801 const StylePath& AsPath() const {
4802 MOZ_DIAGNOSTIC_ASSERT(IsPath())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPath())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPath()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsPath()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4802); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPath()"
")"); do { *((volatile int*)__null) = 4802; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4803 return path._0;
4804 }
4805
4806 static StyleGenericPathOrShapeFunction Shape(const StyleShape<Angle, LengthPercentage> &_0) {
4807 StyleGenericPathOrShapeFunction result;
4808 ::new (&result.shape._0) (StyleShape<Angle, LengthPercentage>)(_0);
4809 result.tag = Tag::Shape;
4810 return result;
4811 }
4812
4813 bool IsShape() const {
4814 return tag == Tag::Shape;
4815 }
4816
4817 const StyleShape<Angle, LengthPercentage>& AsShape() const {
4818 MOZ_DIAGNOSTIC_ASSERT(IsShape())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsShape())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsShape()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsShape()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4818); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsShape()"
")"); do { *((volatile int*)__null) = 4818; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4819 return shape._0;
4820 }
4821
4822 bool operator==(const StyleGenericPathOrShapeFunction& other) const {
4823 if (tag != other.tag) {
4824 return false;
4825 }
4826 switch (tag) {
4827 case Tag::Path: return path == other.path;
4828 case Tag::Shape: return shape == other.shape;
4829
4830 }
4831 return true;
4832 }
4833
4834 bool operator!=(const StyleGenericPathOrShapeFunction& other) const {
4835 return !(*this == other);
4836 }
4837
4838 private:
4839 StyleGenericPathOrShapeFunction() {
4840
4841 }
4842 public:
4843
4844
4845 ~StyleGenericPathOrShapeFunction() {
4846 switch (tag) {
4847 case Tag::Path: path.~StylePath_Body(); break;
4848 case Tag::Shape: shape.~StyleShape_Body(); break;
4849
4850 }
4851 }
4852
4853 StyleGenericPathOrShapeFunction(const StyleGenericPathOrShapeFunction& other)
4854 : tag(other.tag) {
4855 switch (tag) {
4856 case Tag::Path: ::new (&path) (StylePath_Body)(other.path); break;
4857 case Tag::Shape: ::new (&shape) (StyleShape_Body)(other.shape); break;
4858
4859 }
4860 }
4861 StyleGenericPathOrShapeFunction& operator=(const StyleGenericPathOrShapeFunction& other) {
4862 if (this != &other) {
4863 this->~StyleGenericPathOrShapeFunction();
4864 new (this) StyleGenericPathOrShapeFunction(other);
4865 }
4866 return *this;
4867 }
4868};
4869
4870/// The <basic-shape>.
4871///
4872/// https://drafts.csswg.org/css-shapes-1/#supported-basic-shapes
4873template<typename Angle, typename Position, typename LengthPercentage, typename NonNegativeLengthPercentage, typename BasicShapeRect>
4874struct StyleGenericBasicShape {
4875 enum class Tag : uint8_t {
4876 /// The <basic-shape-rect>.
4877 Rect,
4878 /// Defines a circle with a center and a radius.
4879 Circle,
4880 /// Defines an ellipse with a center and x-axis/y-axis radii.
4881 Ellipse,
4882 /// Defines a polygon with pair arguments.
4883 Polygon,
4884 /// Defines a path() or shape().
4885 PathOrShape,
4886 };
4887
4888 struct StyleRect_Body {
4889 BasicShapeRect _0;
4890
4891 bool operator==(const StyleRect_Body& other) const {
4892 return _0 == other._0;
4893 }
4894 bool operator!=(const StyleRect_Body& other) const {
4895 return _0 != other._0;
4896 }
4897 };
4898
4899 struct StyleCircle_Body {
4900 StyleCircle<Position, NonNegativeLengthPercentage> _0;
4901
4902 bool operator==(const StyleCircle_Body& other) const {
4903 return _0 == other._0;
4904 }
4905 bool operator!=(const StyleCircle_Body& other) const {
4906 return _0 != other._0;
4907 }
4908 };
4909
4910 struct StyleEllipse_Body {
4911 StyleEllipse<Position, NonNegativeLengthPercentage> _0;
4912
4913 bool operator==(const StyleEllipse_Body& other) const {
4914 return _0 == other._0;
4915 }
4916 bool operator!=(const StyleEllipse_Body& other) const {
4917 return _0 != other._0;
4918 }
4919 };
4920
4921 struct StylePolygon_Body {
4922 StyleGenericPolygon<LengthPercentage> _0;
4923
4924 bool operator==(const StylePolygon_Body& other) const {
4925 return _0 == other._0;
4926 }
4927 bool operator!=(const StylePolygon_Body& other) const {
4928 return _0 != other._0;
4929 }
4930 };
4931
4932 struct StylePathOrShape_Body {
4933 StyleGenericPathOrShapeFunction<Angle, LengthPercentage> _0;
4934
4935 bool operator==(const StylePathOrShape_Body& other) const {
4936 return _0 == other._0;
4937 }
4938 bool operator!=(const StylePathOrShape_Body& other) const {
4939 return _0 != other._0;
4940 }
4941 };
4942
4943 Tag tag;
4944 union {
4945 StyleRect_Body rect;
4946 StyleCircle_Body circle;
4947 StyleEllipse_Body ellipse;
4948 StylePolygon_Body polygon;
4949 StylePathOrShape_Body path_or_shape;
4950 };
4951
4952 static StyleGenericBasicShape Rect(const BasicShapeRect &_0) {
4953 StyleGenericBasicShape result;
4954 ::new (&result.rect._0) (BasicShapeRect)(_0);
4955 result.tag = Tag::Rect;
4956 return result;
4957 }
4958
4959 bool IsRect() const {
4960 return tag == Tag::Rect;
4961 }
4962
4963 const BasicShapeRect& AsRect() const {
4964 MOZ_DIAGNOSTIC_ASSERT(IsRect())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRect())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRect()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsRect()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4964); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRect()"
")"); do { *((volatile int*)__null) = 4964; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4965 return rect._0;
4966 }
4967
4968 static StyleGenericBasicShape Circle(const StyleCircle<Position, NonNegativeLengthPercentage> &_0) {
4969 StyleGenericBasicShape result;
4970 ::new (&result.circle._0) (StyleCircle<Position, NonNegativeLengthPercentage>)(_0);
4971 result.tag = Tag::Circle;
4972 return result;
4973 }
4974
4975 bool IsCircle() const {
4976 return tag == Tag::Circle;
4977 }
4978
4979 const StyleCircle<Position, NonNegativeLengthPercentage>& AsCircle() const {
4980 MOZ_DIAGNOSTIC_ASSERT(IsCircle())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCircle())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCircle()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsCircle()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4980); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCircle()"
")"); do { *((volatile int*)__null) = 4980; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4981 return circle._0;
4982 }
4983
4984 static StyleGenericBasicShape Ellipse(const StyleEllipse<Position, NonNegativeLengthPercentage> &_0) {
4985 StyleGenericBasicShape result;
4986 ::new (&result.ellipse._0) (StyleEllipse<Position, NonNegativeLengthPercentage>)(_0);
4987 result.tag = Tag::Ellipse;
4988 return result;
4989 }
4990
4991 bool IsEllipse() const {
4992 return tag == Tag::Ellipse;
4993 }
4994
4995 const StyleEllipse<Position, NonNegativeLengthPercentage>& AsEllipse() const {
4996 MOZ_DIAGNOSTIC_ASSERT(IsEllipse())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsEllipse())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsEllipse()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsEllipse()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 4996); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsEllipse()"
")"); do { *((volatile int*)__null) = 4996; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
4997 return ellipse._0;
4998 }
4999
5000 static StyleGenericBasicShape Polygon(const StyleGenericPolygon<LengthPercentage> &_0) {
5001 StyleGenericBasicShape result;
5002 ::new (&result.polygon._0) (StyleGenericPolygon<LengthPercentage>)(_0);
5003 result.tag = Tag::Polygon;
5004 return result;
5005 }
5006
5007 bool IsPolygon() const {
5008 return tag == Tag::Polygon;
5009 }
5010
5011 const StyleGenericPolygon<LengthPercentage>& AsPolygon() const {
5012 MOZ_DIAGNOSTIC_ASSERT(IsPolygon())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPolygon())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPolygon()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsPolygon()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 5012); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPolygon()"
")"); do { *((volatile int*)__null) = 5012; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
5013 return polygon._0;
5014 }
5015
5016 static StyleGenericBasicShape PathOrShape(const StyleGenericPathOrShapeFunction<Angle, LengthPercentage> &_0) {
5017 StyleGenericBasicShape result;
5018 ::new (&result.path_or_shape._0) (StyleGenericPathOrShapeFunction<Angle, LengthPercentage>)(_0);
5019 result.tag = Tag::PathOrShape;
5020 return result;
5021 }
5022
5023 bool IsPathOrShape() const {
5024 return tag == Tag::PathOrShape;
5025 }
5026
5027 const StyleGenericPathOrShapeFunction<Angle, LengthPercentage>& AsPathOrShape() const {
5028 MOZ_DIAGNOSTIC_ASSERT(IsPathOrShape())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPathOrShape())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPathOrShape()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPathOrShape()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 5028); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPathOrShape()"
")"); do { *((volatile int*)__null) = 5028; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
5029 return path_or_shape._0;
5030 }
5031
5032 bool operator==(const StyleGenericBasicShape& other) const {
5033 if (tag != other.tag) {
5034 return false;
5035 }
5036 switch (tag) {
5037 case Tag::Rect: return rect == other.rect;
5038 case Tag::Circle: return circle == other.circle;
5039 case Tag::Ellipse: return ellipse == other.ellipse;
5040 case Tag::Polygon: return polygon == other.polygon;
5041 case Tag::PathOrShape: return path_or_shape == other.path_or_shape;
5042
5043 }
5044 return true;
5045 }
5046
5047 bool operator!=(const StyleGenericBasicShape& other) const {
5048 return !(*this == other);
5049 }
5050
5051 private:
5052 StyleGenericBasicShape() {
5053
5054 }
5055 public:
5056
5057
5058 ~StyleGenericBasicShape() {
5059 switch (tag) {
5060 case Tag::Rect: rect.~StyleRect_Body(); break;
5061 case Tag::Circle: circle.~StyleCircle_Body(); break;
5062 case Tag::Ellipse: ellipse.~StyleEllipse_Body(); break;
5063 case Tag::Polygon: polygon.~StylePolygon_Body(); break;
5064 case Tag::PathOrShape: path_or_shape.~StylePathOrShape_Body(); break;
5065
5066 }
5067 }
5068
5069 StyleGenericBasicShape(const StyleGenericBasicShape& other)
5070 : tag(other.tag) {
5071 switch (tag) {
5072 case Tag::Rect: ::new (&rect) (StyleRect_Body)(other.rect); break;
5073 case Tag::Circle: ::new (&circle) (StyleCircle_Body)(other.circle); break;
5074 case Tag::Ellipse: ::new (&ellipse) (StyleEllipse_Body)(other.ellipse); break;
5075 case Tag::Polygon: ::new (&polygon) (StylePolygon_Body)(other.polygon); break;
5076 case Tag::PathOrShape: ::new (&path_or_shape) (StylePathOrShape_Body)(other.path_or_shape); break;
5077
5078 }
5079 }
5080 StyleGenericBasicShape& operator=(const StyleGenericBasicShape& other) {
5081 if (this != &other) {
5082 this->~StyleGenericBasicShape();
5083 new (this) StyleGenericBasicShape(other);
5084 }
5085 return *this;
5086 }
5087};
5088
5089/// A computed basic shape.
5090using StyleBasicShape = StyleGenericBasicShape<StyleAngle, StylePosition, StyleLengthPercentage, StyleNonNegativeLengthPercentage, StyleInsetRect>;
5091
5092/// The `ray()` function, `ray( [ <angle> && <size> && contain? && [at <position>]? ] )`
5093///
5094/// https://drafts.fxtf.org/motion-1/#valdef-offsetpath-ray
5095template<typename Angle, typename Position>
5096struct StyleGenericRayFunction {
5097 /// The bearing angle with `0deg` pointing up and positive angles
5098 /// representing clockwise rotation.
5099 Angle angle;
5100 /// Decide the path length used when `offset-distance` is expressed
5101 /// as a percentage.
5102 StyleRaySize size;
5103 /// Clamp `offset-distance` so that the box is entirely contained
5104 /// within the path.
5105 bool contain;
5106 /// The "at <position>" part. If omitted, we use auto to represent it.
5107 StyleGenericPositionOrAuto<Position> position;
5108
5109 bool operator==(const StyleGenericRayFunction& other) const {
5110 return angle == other.angle &&
5111 size == other.size &&
5112 contain == other.contain &&
5113 position == other.position;
5114 }
5115 bool operator!=(const StyleGenericRayFunction& other) const {
5116 return angle != other.angle ||
5117 size != other.size ||
5118 contain != other.contain ||
5119 position != other.position;
5120 }
5121};
5122
5123/// The computed value of ray() function.
5124using StyleRayFunction = StyleGenericRayFunction<StyleAngle, StylePosition>;
5125
5126/// A struct that basically replaces a Box<str>, but with a defined layout,
5127/// suitable for FFI.
5128struct StyleOwnedStr {
5129 StyleOwnedSlice<uint8_t> _0;
5130
5131 bool operator==(const StyleOwnedStr& other) const {
5132 return _0 == other._0;
5133 }
5134 bool operator!=(const StyleOwnedStr& other) const {
5135 return _0 != other._0;
5136 }
5137 inline nsDependentCSubstring AsString() const;
5138};
5139
5140#if defined(CBINDGEN_IS_GECKO)
5141/// Extra data that the backend may need to resolve url values.
5142///
5143/// If the usize's lowest bit is 0, then this is a strong reference to a
5144/// structs::URLExtraData object.
5145///
5146/// Otherwise, shifting the usize's bits the right by one gives the
5147/// UserAgentStyleSheetID value corresponding to the style sheet whose
5148/// URLExtraData this is, which is stored in URLExtraData_sShared. We don't
5149/// hold a strong reference to that object from here, but we rely on that
5150/// array's objects being held alive until shutdown.
5151///
5152/// We use this packed representation rather than an enum so that
5153/// `from_ptr_ref` can work.
5154struct StyleUrlExtraData {
5155 uintptr_t _0;
5156
5157 bool operator==(const StyleUrlExtraData& other) const {
5158 return _0 == other._0;
5159 }
5160 bool operator!=(const StyleUrlExtraData& other) const {
5161 return _0 != other._0;
5162 }
5163 StyleUrlExtraData() = delete;
5164
5165 // Could be implemented if wanted.
5166 StyleUrlExtraData(const StyleUrlExtraData&) = delete;
5167 StyleUrlExtraData& operator=(const StyleUrlExtraData&) = delete;
5168
5169 inline bool IsShared() const;
5170
5171 inline ~StyleUrlExtraData();
5172 inline const URLExtraData& get() const;
5173};
5174#endif
5175
5176#if defined(CBINDGEN_IS_GECKO)
5177/// Various bits of mutable state that are kept for image loads.
5178struct StyleLoadDataFlags {
5179 uint8_t bits;
5180
5181 constexpr explicit operator bool() const {
5182 return !!bits;
5183 }
5184 constexpr StyleLoadDataFlags operator~() const {
5185 return StyleLoadDataFlags { static_cast<decltype(bits)>(~bits) };
5186 }
5187 constexpr StyleLoadDataFlags operator|(const StyleLoadDataFlags& other) const {
5188 return StyleLoadDataFlags { static_cast<decltype(bits)>(this->bits | other.bits) };
5189 }
5190 StyleLoadDataFlags& operator|=(const StyleLoadDataFlags& other) {
5191 *this = (*this | other);
5192 return *this;
5193 }
5194 constexpr StyleLoadDataFlags operator&(const StyleLoadDataFlags& other) const {
5195 return StyleLoadDataFlags { static_cast<decltype(bits)>(this->bits & other.bits) };
5196 }
5197 StyleLoadDataFlags& operator&=(const StyleLoadDataFlags& other) {
5198 *this = (*this & other);
5199 return *this;
5200 }
5201 constexpr StyleLoadDataFlags operator^(const StyleLoadDataFlags& other) const {
5202 return StyleLoadDataFlags { static_cast<decltype(bits)>(this->bits ^ other.bits) };
5203 }
5204 StyleLoadDataFlags& operator^=(const StyleLoadDataFlags& other) {
5205 *this = (*this ^ other);
5206 return *this;
5207 }
5208 bool operator==(const StyleLoadDataFlags& other) const {
5209 return bits == other.bits;
5210 }
5211 bool operator!=(const StyleLoadDataFlags& other) const {
5212 return bits != other.bits;
5213 }
5214 static const StyleLoadDataFlags TRIED_TO_RESOLVE_URI;
5215 static const StyleLoadDataFlags TRIED_TO_RESOLVE_IMAGE;
5216};
5217#if defined(CBINDGEN_IS_GECKO)
5218/// Whether we tried to resolve the uri at least once.
5219constexpr inline const StyleLoadDataFlags StyleLoadDataFlags::TRIED_TO_RESOLVE_URI = StyleLoadDataFlags{ /* .bits = */ (uint8_t)(1 << 0) };
5220#endif
5221#if defined(CBINDGEN_IS_GECKO)
5222/// Whether we tried to resolve the image at least once.
5223constexpr inline const StyleLoadDataFlags StyleLoadDataFlags::TRIED_TO_RESOLVE_IMAGE = StyleLoadDataFlags{ /* .bits = */ (uint8_t)(1 << 1) };
5224#endif
5225#endif
5226
5227#if defined(CBINDGEN_IS_GECKO)
5228/// The load data for a given URL. This is mutable from C++, and shouldn't be
5229/// accessed from rust for anything.
5230struct StyleLoadData {
5231 /// A strong reference to the imgRequestProxy, if any, that should be
5232 /// released on drop.
5233 ///
5234 /// These are raw pointers because they are not safe to reference-count off
5235 /// the main thread.
5236 imgRequestProxy *resolved_image;
5237 /// A strong reference to the resolved URI of this image.
5238 nsIURI *resolved_uri;
5239 /// A few flags that are set when resolving the image or such.
5240 StyleLoadDataFlags flags;
5241
5242 bool operator==(const StyleLoadData& other) const {
5243 return resolved_image == other.resolved_image &&
5244 resolved_uri == other.resolved_uri &&
5245 flags == other.flags;
5246 }
5247 bool operator!=(const StyleLoadData& other) const {
5248 return resolved_image != other.resolved_image ||
5249 resolved_uri != other.resolved_uri ||
5250 flags != other.flags;
5251 }
5252 ~StyleLoadData();
5253};
5254#endif
5255
5256#if defined(CBINDGEN_IS_GECKO)
5257/// The data for a load, or a lazy-loaded, static member that will be stored in
5258/// LOAD_DATA_TABLE, keyed by the memory location of this object, which is
5259/// always in the heap because it's inside the CssUrlData object.
5260///
5261/// This type is meant not to be used from C++ so we don't derive helper
5262/// methods.
5263///
5264struct StyleLoadDataSource {
5265 enum class Tag : uint8_t {
5266#if defined(CBINDGEN_IS_GECKO)
5267 /// An owned copy of the load data.
5268 Owned,
5269#endif
5270#if defined(CBINDGEN_IS_GECKO)
5271 /// A lazily-resolved copy of it.
5272 Lazy,
5273#endif
5274 };
5275
5276#if defined(CBINDGEN_IS_GECKO)
5277 struct StyleOwned_Body {
5278 StyleLoadData _0;
5279
5280 bool operator==(const StyleOwned_Body& other) const {
5281 return _0 == other._0;
5282 }
5283 bool operator!=(const StyleOwned_Body& other) const {
5284 return _0 != other._0;
5285 }
5286 };
5287#endif
5288
5289 Tag tag;
5290 union {
5291#if defined(CBINDGEN_IS_GECKO)
5292 StyleOwned_Body owned;
5293#endif
5294 };
5295
5296 bool operator==(const StyleLoadDataSource& other) const {
5297 if (tag != other.tag) {
5298 return false;
5299 }
5300 switch (tag) {
5301#if defined(CBINDGEN_IS_GECKO)
5302 case Tag::Owned: return owned == other.owned;
5303#endif
5304 default: break;
5305 }
5306 return true;
5307 }
5308
5309 bool operator!=(const StyleLoadDataSource& other) const {
5310 return !(*this == other);
5311 }
5312
5313 private:
5314 StyleLoadDataSource() {
5315
5316 }
5317 public:
5318
5319
5320 ~StyleLoadDataSource() {
5321 switch (tag) {
5322#if defined(CBINDGEN_IS_GECKO)
5323 case Tag::Owned: owned.~StyleOwned_Body(); break;
5324#endif
5325 default: break;
5326 }
5327 }
5328
5329 StyleLoadDataSource(const StyleLoadDataSource& other)
5330 : tag(other.tag) {
5331 switch (tag) {
5332#if defined(CBINDGEN_IS_GECKO)
5333 case Tag::Owned: ::new (&owned) (StyleOwned_Body)(other.owned); break;
5334#endif
5335 default: break;
5336 }
5337 }
5338 StyleLoadDataSource& operator=(const StyleLoadDataSource& other) {
5339 if (this != &other) {
5340 this->~StyleLoadDataSource();
5341 new (this) StyleLoadDataSource(other);
5342 }
5343 return *this;
5344 }
5345};
5346#endif
5347
5348#if defined(CBINDGEN_IS_GECKO)
5349/// Data shared between CssUrls.
5350///
5351struct StyleCssUrlData {
5352 /// The URL in unresolved string form.
5353 StyleOwnedStr serialization;
5354 /// The URL extra data.
5355 StyleUrlExtraData extra_data;
5356 /// The CORS mode that will be used for the load.
5357 StyleCorsMode cors_mode;
5358 /// Data to trigger a load from Gecko. This is mutable in C++.
5359 ///
5360 /// TODO(emilio): Maybe we can eagerly resolve URLs and make this immutable?
5361 StyleLoadDataSource load_data;
5362 // Implemented in nsStyleStruct.cpp
5363 bool operator==(const StyleCssUrlData& other) const;
5364 bool operator!=(const StyleCssUrlData& other) const {
5365 return !(*this == other);
5366 }
5367};
5368#endif
5369
5370#if defined(CBINDGEN_IS_GECKO)
5371/// A CSS url() value for gecko.
5372struct StyleCssUrl {
5373 StyleArc<StyleCssUrlData> _0;
5374
5375 bool operator==(const StyleCssUrl& other) const {
5376 return _0 == other._0;
5377 }
5378 bool operator!=(const StyleCssUrl& other) const {
5379 return _0 != other._0;
5380 }
5381 inline nsDependentCSubstring SpecifiedSerialization() const;
5382 inline const URLExtraData& ExtraData() const;
5383 inline StyleLoadData& LoadData() const;
5384 inline nsIURI* GetURI() const;
5385};
5386#endif
5387
5388#if defined(CBINDGEN_IS_GECKO)
5389/// A specified non-image `url()` value.
5390using StyleSpecifiedUrl = StyleCssUrl;
5391#endif
5392
5393#if defined(CBINDGEN_IS_SERVO)
5394/// A specified url() value for servo.
5395using StyleSpecifiedUrl = StyleCssUrl;
5396#endif
5397
5398#if defined(CBINDGEN_IS_GECKO)
5399/// The computed value of a CSS non-image `url()`.
5400///
5401/// The only difference between specified and computed URLs is the
5402/// serialization.
5403struct StyleComputedUrl {
5404 StyleSpecifiedUrl _0;
5405
5406 bool operator==(const StyleComputedUrl& other) const {
5407 return _0 == other._0;
5408 }
5409 bool operator!=(const StyleComputedUrl& other) const {
5410 return _0 != other._0;
5411 }
5412 // Forwarded from CssUrl.
5413 inline nsDependentCSubstring SpecifiedSerialization() const;
5414 inline const URLExtraData& ExtraData() const;
5415 inline nsIURI* GetURI() const;
5416 inline StyleLoadData& LoadData() const;
5417
5418 inline bool IsLocalRef() const;
5419 inline bool HasRef() const;
5420 inline StyleCorsMode CorsMode() const;
5421 already_AddRefed<nsIURI> ResolveLocalRef(nsIURI* aBase) const;
5422 already_AddRefed<nsIURI> ResolveLocalRef(const nsIContent* aContent) const;
5423
5424 // Only relevant for images.
5425 inline bool IsImageResolved() const;
5426 inline imgRequestProxy* GetImage() const;
5427 void ResolveImage(dom::Document&, const StyleComputedUrl* aOldImage);
5428};
5429#endif
5430
5431/// The <offset-path> value.
5432/// <offset-path> = <ray()> | <url> | <basic-shape>
5433///
5434/// https://drafts.fxtf.org/motion-1/#typedef-offset-path
5435template<typename Shapes, typename RayFunction, typename U>
5436struct StyleGenericOffsetPathFunction {
5437 enum class Tag : uint8_t {
5438 /// ray() function, which defines a path in the polar coordinate system.
5439 /// Use Box<> to make sure the size of offset-path is not too large.
5440 Ray,
5441 /// A URL reference to an SVG shape element. If the URL does not reference a shape element,
5442 /// this behaves as path("m 0 0") instead.
5443 Url,
5444 /// The <basic-shape> value.
5445 Shape,
5446 };
5447
5448 struct StyleRay_Body {
5449 RayFunction _0;
5450
5451 bool operator==(const StyleRay_Body& other) const {
5452 return _0 == other._0;
5453 }
5454 bool operator!=(const StyleRay_Body& other) const {
5455 return _0 != other._0;
5456 }
5457 };
5458
5459 struct StyleUrl_Body {
5460 U _0;
5461
5462 bool operator==(const StyleUrl_Body& other) const {
5463 return _0 == other._0;
5464 }
5465 bool operator!=(const StyleUrl_Body& other) const {
5466 return _0 != other._0;
5467 }
5468 };
5469
5470 struct StyleShape_Body {
5471 Shapes _0;
5472
5473 bool operator==(const StyleShape_Body& other) const {
5474 return _0 == other._0;
5475 }
5476 bool operator!=(const StyleShape_Body& other) const {
5477 return _0 != other._0;
5478 }
5479 };
5480
5481 Tag tag;
5482 union {
5483 StyleRay_Body ray;
5484 StyleUrl_Body url;
5485 StyleShape_Body shape;
5486 };
5487
5488 static StyleGenericOffsetPathFunction Ray(const RayFunction &_0) {
5489 StyleGenericOffsetPathFunction result;
5490 ::new (&result.ray._0) (RayFunction)(_0);
5491 result.tag = Tag::Ray;
5492 return result;
5493 }
5494
5495 bool IsRay() const {
5496 return tag == Tag::Ray;
5497 }
5498
5499 const RayFunction& AsRay() const {
5500 MOZ_DIAGNOSTIC_ASSERT(IsRay())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRay())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRay()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsRay()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 5500); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRay()"
")"); do { *((volatile int*)__null) = 5500; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
5501 return ray._0;
5502 }
5503
5504 static StyleGenericOffsetPathFunction Url(const U &_0) {
5505 StyleGenericOffsetPathFunction result;
5506 ::new (&result.url._0) (U)(_0);
5507 result.tag = Tag::Url;
5508 return result;
5509 }
5510
5511 bool IsUrl() const {
5512 return tag == Tag::Url;
5513 }
5514
5515 const U& AsUrl() const {
5516 MOZ_DIAGNOSTIC_ASSERT(IsUrl())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsUrl())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsUrl()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsUrl()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 5516); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsUrl()"
")"); do { *((volatile int*)__null) = 5516; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
5517 return url._0;
5518 }
5519
5520 static StyleGenericOffsetPathFunction Shape(const Shapes &_0) {
5521 StyleGenericOffsetPathFunction result;
5522 ::new (&result.shape._0) (Shapes)(_0);
5523 result.tag = Tag::Shape;
5524 return result;
5525 }
5526
5527 bool IsShape() const {
5528 return tag == Tag::Shape;
5529 }
5530
5531 const Shapes& AsShape() const {
5532 MOZ_DIAGNOSTIC_ASSERT(IsShape())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsShape())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsShape()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsShape()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 5532); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsShape()"
")"); do { *((volatile int*)__null) = 5532; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
5533 return shape._0;
5534 }
5535
5536 bool operator==(const StyleGenericOffsetPathFunction& other) const {
5537 if (tag != other.tag) {
5538 return false;
5539 }
5540 switch (tag) {
5541 case Tag::Ray: return ray == other.ray;
5542 case Tag::Url: return url == other.url;
5543 case Tag::Shape: return shape == other.shape;
5544
5545 }
5546 return true;
5547 }
5548
5549 bool operator!=(const StyleGenericOffsetPathFunction& other) const {
5550 return !(*this == other);
5551 }
5552
5553 private:
5554 StyleGenericOffsetPathFunction() {
5555
5556 }
5557 public:
5558
5559
5560 ~StyleGenericOffsetPathFunction() {
5561 switch (tag) {
5562 case Tag::Ray: ray.~StyleRay_Body(); break;
5563 case Tag::Url: url.~StyleUrl_Body(); break;
5564 case Tag::Shape: shape.~StyleShape_Body(); break;
5565
5566 }
5567 }
5568
5569 StyleGenericOffsetPathFunction(const StyleGenericOffsetPathFunction& other)
5570 : tag(other.tag) {
5571 switch (tag) {
5572 case Tag::Ray: ::new (&ray) (StyleRay_Body)(other.ray); break;
5573 case Tag::Url: ::new (&url) (StyleUrl_Body)(other.url); break;
5574 case Tag::Shape: ::new (&shape) (StyleShape_Body)(other.shape); break;
5575
5576 }
5577 }
5578 StyleGenericOffsetPathFunction& operator=(const StyleGenericOffsetPathFunction& other) {
5579 if (this != &other) {
5580 this->~StyleGenericOffsetPathFunction();
5581 new (this) StyleGenericOffsetPathFunction(other);
5582 }
5583 return *this;
5584 }
5585};
5586
5587/// The computed value of <offset-path>.
5588using StyleOffsetPathFunction = StyleGenericOffsetPathFunction<StyleBasicShape, StyleRayFunction, StyleComputedUrl>;
5589
5590/// The offset-path property.
5591/// offset-path: none | <offset-path> || <coord-box>
5592///
5593/// https://drafts.fxtf.org/motion-1/#offset-path-property
5594template<typename Function>
5595struct StyleGenericOffsetPath {
5596 enum class Tag : uint8_t {
5597 /// <offset-path> || <coord-box>.
5598 OffsetPath,
5599 /// Only <coord-box>. This represents that <offset-path> is omitted, so we use the default
5600 /// value, inset(0 round X), where X is the value of border-radius on the element that
5601 /// establishes the containing block for this element.
5602 CoordBox,
5603 /// None value.
5604 None,
5605 };
5606
5607 struct StyleOffsetPath_Body {
5608 /// <offset-path> part.
5609 StyleBox<Function> path;
5610 /// <coord-box> part.
5611 StyleCoordBox coord_box;
5612
5613 bool operator==(const StyleOffsetPath_Body& other) const {
5614 return path == other.path &&
5615 coord_box == other.coord_box;
5616 }
5617 bool operator!=(const StyleOffsetPath_Body& other) const {
5618 return path != other.path ||
5619 coord_box != other.coord_box;
5620 }
5621 };
5622
5623 struct StyleCoordBox_Body {
5624 StyleCoordBox _0;
5625
5626 bool operator==(const StyleCoordBox_Body& other) const {
5627 return _0 == other._0;
5628 }
5629 bool operator!=(const StyleCoordBox_Body& other) const {
5630 return _0 != other._0;
5631 }
5632 };
5633
5634 Tag tag;
5635 union {
5636 StyleOffsetPath_Body offset_path;
5637 StyleCoordBox_Body coord_box;
5638 };
5639
5640 static StyleGenericOffsetPath OffsetPath(const StyleBox<Function> &path,
5641 const StyleCoordBox &coord_box) {
5642 StyleGenericOffsetPath result;
5643 ::new (&result.offset_path.path) (StyleBox<Function>)(path);
5644 ::new (&result.offset_path.coord_box) (StyleCoordBox)(coord_box);
5645 result.tag = Tag::OffsetPath;
5646 return result;
5647 }
5648
5649 bool IsOffsetPath() const {
5650 return tag == Tag::OffsetPath;
5651 }
5652
5653 const StyleOffsetPath_Body& AsOffsetPath() const {
5654 MOZ_DIAGNOSTIC_ASSERT(IsOffsetPath())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsOffsetPath())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsOffsetPath()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsOffsetPath()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 5654); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsOffsetPath()"
")"); do { *((volatile int*)__null) = 5654; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
5655 return offset_path;
5656 }
5657
5658 static StyleGenericOffsetPath CoordBox(const StyleCoordBox &_0) {
5659 StyleGenericOffsetPath result;
5660 ::new (&result.coord_box._0) (StyleCoordBox)(_0);
5661 result.tag = Tag::CoordBox;
5662 return result;
5663 }
5664
5665 bool IsCoordBox() const {
5666 return tag == Tag::CoordBox;
5667 }
5668
5669 const StyleCoordBox& AsCoordBox() const {
5670 MOZ_DIAGNOSTIC_ASSERT(IsCoordBox())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCoordBox())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCoordBox()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsCoordBox()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 5670); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCoordBox()"
")"); do { *((volatile int*)__null) = 5670; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
5671 return coord_box._0;
5672 }
5673
5674 static StyleGenericOffsetPath None() {
5675 StyleGenericOffsetPath result;
5676 result.tag = Tag::None;
5677 return result;
5678 }
5679
5680 bool IsNone() const {
5681 return tag == Tag::None;
5682 }
5683
5684 bool operator==(const StyleGenericOffsetPath& other) const {
5685 if (tag != other.tag) {
5686 return false;
5687 }
5688 switch (tag) {
5689 case Tag::OffsetPath: return offset_path == other.offset_path;
5690 case Tag::CoordBox: return coord_box == other.coord_box;
5691 default: break;
5692 }
5693 return true;
5694 }
5695
5696 bool operator!=(const StyleGenericOffsetPath& other) const {
5697 return !(*this == other);
5698 }
5699
5700 private:
5701 StyleGenericOffsetPath() {
5702
5703 }
5704 public:
5705
5706
5707 ~StyleGenericOffsetPath() {
5708 switch (tag) {
5709 case Tag::OffsetPath: offset_path.~StyleOffsetPath_Body(); break;
5710 case Tag::CoordBox: coord_box.~StyleCoordBox_Body(); break;
5711 default: break;
5712 }
5713 }
5714
5715 StyleGenericOffsetPath(const StyleGenericOffsetPath& other)
5716 : tag(other.tag) {
5717 switch (tag) {
5718 case Tag::OffsetPath: ::new (&offset_path) (StyleOffsetPath_Body)(other.offset_path); break;
5719 case Tag::CoordBox: ::new (&coord_box) (StyleCoordBox_Body)(other.coord_box); break;
5720 default: break;
5721 }
5722 }
5723 StyleGenericOffsetPath& operator=(const StyleGenericOffsetPath& other) {
5724 if (this != &other) {
5725 this->~StyleGenericOffsetPath();
5726 new (this) StyleGenericOffsetPath(other);
5727 }
5728 return *this;
5729 }
5730 // Return true if the <offset-path> is ray().
5731 bool IsRay() const {
5732 return IsOffsetPath() && AsOffsetPath().path->IsRay();
5733 }
5734
5735 const StyleRayFunction& AsRay() const {
5736 return AsOffsetPath().path->AsRay();
5737 }
5738
5739 // Return true if the <offset-path> is url().
5740 bool IsUrl() const {
5741 return IsOffsetPath() && AsOffsetPath().path->IsUrl();
5742 }
5743
5744 const StyleComputedUrl& AsUrl() const {
5745 return AsOffsetPath().path->AsUrl();
5746 }
5747
5748 // Return true if the <basic-shape> is path().
5749 bool IsPath() const {
5750 if (!IsOffsetPath()) {
5751 return false;
5752 }
5753 const auto& path = AsOffsetPath().path;
5754 if (!path->IsShape()) {
5755 return false;
5756 }
5757 const auto& shape = path->AsShape();
5758 return shape.IsPathOrShape() && shape.AsPathOrShape().IsPath();
5759 }
5760
5761 const StyleSVGPathData& AsSVGPathData() const {
5762 return AsOffsetPath().path->AsShape().AsPathOrShape().AsPath().path;
5763 }
5764
5765 // Return true if this is "<basic-shape> || <coord-box>".
5766 bool IsBasicShapeOrCoordBox() const {
5767 return IsCoordBox() || (IsOffsetPath() && AsOffsetPath().path->IsShape());
5768 }
5769};
5770
5771/// The computed value of `offset-path`.
5772using StyleOffsetPath = StyleGenericOffsetPath<StyleOffsetPathFunction>;
5773
5774/// A computed offset-rotate.
5775struct StyleOffsetRotate {
5776 /// If auto is false, this is a fixed angle which indicates a
5777 /// constant clockwise rotation transformation applied to it by this
5778 /// specified rotation angle. Otherwise, the angle will be added to
5779 /// the angle of the direction in layout.
5780 bool auto_;
5781 /// The angle value.
5782 StyleAngle angle;
5783
5784 bool operator==(const StyleOffsetRotate& other) const {
5785 return auto_ == other.auto_ &&
5786 angle == other.angle;
5787 }
5788 bool operator!=(const StyleOffsetRotate& other) const {
5789 return auto_ != other.auto_ ||
5790 angle != other.angle;
5791 }
5792};
5793
5794/// The computed value of an `auto | <position>`
5795using StylePositionOrAuto = StyleGenericPositionOrAuto<StylePosition>;
5796
5797/// The offset-position property, which specifies the offset starting position that is used by the
5798/// <offset-path> functions if they don’t specify their own starting position.
5799///
5800/// https://drafts.fxtf.org/motion-1/#offset-position-property
5801template<typename H, typename V>
5802struct StyleGenericOffsetPosition {
5803 enum class Tag : uint8_t {
5804 /// The element does not have an offset starting position.
5805 Normal,
5806 /// The offset starting position is the top-left corner of the box.
5807 Auto,
5808 /// The offset starting position is the result of using the <position> to position a 0x0 object
5809 /// area within the box’s containing block.
5810 Position,
5811 };
5812
5813 struct StylePosition_Body {
5814 StyleGenericPosition<H, V> _0;
5815
5816 bool operator==(const StylePosition_Body& other) const {
5817 return _0 == other._0;
5818 }
5819 bool operator!=(const StylePosition_Body& other) const {
5820 return _0 != other._0;
5821 }
5822 };
5823
5824 Tag tag;
5825 union {
5826 StylePosition_Body position;
5827 };
5828
5829 static StyleGenericOffsetPosition Normal() {
5830 StyleGenericOffsetPosition result;
5831 result.tag = Tag::Normal;
5832 return result;
5833 }
5834
5835 bool IsNormal() const {
5836 return tag == Tag::Normal;
5837 }
5838
5839 static StyleGenericOffsetPosition Auto() {
5840 StyleGenericOffsetPosition result;
5841 result.tag = Tag::Auto;
5842 return result;
5843 }
5844
5845 bool IsAuto() const {
5846 return tag == Tag::Auto;
5847 }
5848
5849 static StyleGenericOffsetPosition Position(const StyleGenericPosition<H, V> &_0) {
5850 StyleGenericOffsetPosition result;
5851 ::new (&result.position._0) (StyleGenericPosition<H, V>)(_0);
5852 result.tag = Tag::Position;
5853 return result;
5854 }
5855
5856 bool IsPosition() const {
5857 return tag == Tag::Position;
5858 }
5859
5860 const StyleGenericPosition<H, V>& AsPosition() const {
5861 MOZ_DIAGNOSTIC_ASSERT(IsPosition())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPosition())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPosition()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsPosition()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 5861); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPosition()"
")"); do { *((volatile int*)__null) = 5861; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
5862 return position._0;
5863 }
5864
5865 bool operator==(const StyleGenericOffsetPosition& other) const {
5866 if (tag != other.tag) {
5867 return false;
5868 }
5869 switch (tag) {
5870 case Tag::Position: return position == other.position;
5871 default: break;
5872 }
5873 return true;
5874 }
5875
5876 bool operator!=(const StyleGenericOffsetPosition& other) const {
5877 return !(*this == other);
5878 }
5879
5880 private:
5881 StyleGenericOffsetPosition() {
5882
5883 }
5884 public:
5885
5886
5887 ~StyleGenericOffsetPosition() {
5888 switch (tag) {
5889 case Tag::Position: position.~StylePosition_Body(); break;
5890 default: break;
5891 }
5892 }
5893
5894 StyleGenericOffsetPosition(const StyleGenericOffsetPosition& other)
5895 : tag(other.tag) {
5896 switch (tag) {
5897 case Tag::Position: ::new (&position) (StylePosition_Body)(other.position); break;
5898 default: break;
5899 }
5900 }
5901 StyleGenericOffsetPosition& operator=(const StyleGenericOffsetPosition& other) {
5902 if (this != &other) {
5903 this->~StyleGenericOffsetPosition();
5904 new (this) StyleGenericOffsetPosition(other);
5905 }
5906 return *this;
5907 }
5908};
5909
5910/// The computed value of `offset-position`.
5911using StyleOffsetPosition = StyleGenericOffsetPosition<StyleLengthPercentage, StyleLengthPercentage>;
5912
5913struct StyleShouldTransitionResult {
5914 bool should_animate;
5915 bool old_transition_value_matches;
5916
5917 bool operator==(const StyleShouldTransitionResult& other) const {
5918 return should_animate == other.should_animate &&
5919 old_transition_value_matches == other.old_transition_value_matches;
5920 }
5921 bool operator!=(const StyleShouldTransitionResult& other) const {
5922 return should_animate != other.should_animate ||
5923 old_transition_value_matches != other.old_transition_value_matches;
5924 }
5925};
5926
5927#if defined(XP_UNIX1)
5928/// Platform-specific handle to a thread.
5929using StylePlatformThreadHandle = pthread_t;
5930#endif
5931
5932#if defined(XP_WIN)
5933/// Platform-specific handle to a thread.
5934using StylePlatformThreadHandle = void*;
5935#endif
5936
5937/// The computed representation of the above so Gecko can read them easily.
5938///
5939/// This one is needed because cbindgen doesn't know how to generate
5940/// specified::Number.
5941struct StyleComputedFontWeightRange {
5942 float _0;
5943 float _1;
5944
5945 bool operator==(const StyleComputedFontWeightRange& other) const {
5946 return _0 == other._0 &&
5947 _1 == other._1;
5948 }
5949 bool operator!=(const StyleComputedFontWeightRange& other) const {
5950 return _0 != other._0 ||
5951 _1 != other._1;
5952 }
5953};
5954
5955/// Generic template for font property type classes that use a fixed-point
5956/// internal representation with `FRACTION_BITS` for the fractional part.
5957///
5958/// Values are constructed from and exposed as floating-point, but stored
5959/// internally as fixed point, so there will be a quantization effect on
5960/// fractional values, depending on the number of fractional bits used.
5961///
5962/// Using (16-bit) fixed-point types rather than floats for these style
5963/// attributes reduces the memory footprint of gfxFontEntry and gfxFontStyle; it
5964/// will also tend to reduce the number of distinct font instances that get
5965/// created, particularly when styles are animated or set to arbitrary values
5966/// (e.g. by sliders in the UI), which should reduce pressure on graphics
5967/// resources and improve cache hit rates.
5968///
5969template<typename T, uint16_t FRACTION_BITS>
5970struct StyleFixedPoint {
5971 /// The actual representation.
5972 T value;
5973
5974 bool operator==(const StyleFixedPoint& other) const {
5975 return value == other.value;
5976 }
5977 bool operator!=(const StyleFixedPoint& other) const {
5978 return value != other.value;
5979 }
5980 bool operator<(const StyleFixedPoint& other) const {
5981 return value < other.value;
5982 }
5983 bool operator<=(const StyleFixedPoint& other) const {
5984 return value <= other.value;
5985 }
5986 bool operator>(const StyleFixedPoint& other) const {
5987 return value > other.value;
5988 }
5989 bool operator>=(const StyleFixedPoint& other) const {
5990 return value >= other.value;
5991 }
5992};
5993
5994/// This is an alias which is useful mostly as a cbindgen / C++ inference
5995/// workaround.
5996using StyleFontStretchFixedPoint = StyleFixedPoint<uint16_t, StyleFONT_STRETCH_FRACTION_BITS>;
5997
5998/// A value for the font-stretch property per:
5999///
6000/// https://drafts.csswg.org/css-fonts-4/#propdef-font-stretch
6001///
6002struct StyleFontStretch {
6003 StyleFontStretchFixedPoint _0;
6004
6005 bool operator==(const StyleFontStretch& other) const {
6006 return _0 == other._0;
6007 }
6008 bool operator!=(const StyleFontStretch& other) const {
6009 return _0 != other._0;
6010 }
6011 bool operator<(const StyleFontStretch& other) const {
6012 return _0 < other._0;
6013 }
6014 bool operator<=(const StyleFontStretch& other) const {
6015 return _0 <= other._0;
6016 }
6017 bool operator>(const StyleFontStretch& other) const {
6018 return _0 > other._0;
6019 }
6020 bool operator>=(const StyleFontStretch& other) const {
6021 return _0 >= other._0;
6022 }
6023 SERVO_FIXED_POINT_HELPERS(StyleFontStretch, uint16_t, StyleFONT_STRETCH_FRACTION_BITS)static constexpr uint16_t kPointFive = 1 << (StyleFONT_STRETCH_FRACTION_BITS
- 1); static constexpr uint16_t kScale = 1 << StyleFONT_STRETCH_FRACTION_BITS
; static constexpr float kInverseScale = 1.0f / kScale; static
StyleFontStretch FromRaw(uint16_t aRaw) { return {{aRaw}}; }
static StyleFontStretch FromFloat(float aFloat) { return FromRaw
(uint16_t(aFloat * kScale)); } static StyleFontStretch FromInt
(uint16_t aInt) { return FromRaw(uint16_t(aInt * kScale)); } uint16_t
Raw() const { return _0.value; } uint16_t UnsignedRaw() const
{ return uint16_t(Raw()); } float ToFloat() const { return Raw
() * kInverseScale; } uint16_t ToIntRounded() const { return (
Raw() + kPointFive) >> StyleFONT_STRETCH_FRACTION_BITS;
} inline void ToString(nsACString&) const;
;
6024 bool IsNormal() const { return *this == NORMAL; }
6025 static const uint16_t FRACTION_BITS;
6026 static const uint16_t HALF;
6027 static const StyleFontStretch ULTRA_CONDENSED;
6028 static const StyleFontStretch EXTRA_CONDENSED;
6029 static const StyleFontStretch CONDENSED;
6030 static const StyleFontStretch SEMI_CONDENSED;
6031 static const StyleFontStretch NORMAL;
6032 static const StyleFontStretch SEMI_EXPANDED;
6033 static const StyleFontStretch EXPANDED;
6034 static const StyleFontStretch EXTRA_EXPANDED;
6035 static const StyleFontStretch ULTRA_EXPANDED;
6036};
6037/// The fraction bits, as an easy-to-access-constant.
6038constexpr inline const uint16_t StyleFontStretch::FRACTION_BITS = StyleFONT_STRETCH_FRACTION_BITS;
6039/// 0.5 in our floating point representation.
6040constexpr inline const uint16_t StyleFontStretch::HALF = (1 << (StyleFontStretch::FRACTION_BITS - 1));
6041/// The `ultra-condensed` keyword.
6042constexpr inline const StyleFontStretch StyleFontStretch::ULTRA_CONDENSED = StyleFontStretch{ /* ._0 = */ StyleFontStretchFixedPoint{ /* .value = */ (50 << StyleFontStretch::FRACTION_BITS) } };
6043/// The `extra-condensed` keyword.
6044constexpr inline const StyleFontStretch StyleFontStretch::EXTRA_CONDENSED = StyleFontStretch{ /* ._0 = */ StyleFontStretchFixedPoint{ /* .value = */ ((62 << StyleFontStretch::FRACTION_BITS) + StyleFontStretch::HALF) } };
6045/// The `condensed` keyword.
6046constexpr inline const StyleFontStretch StyleFontStretch::CONDENSED = StyleFontStretch{ /* ._0 = */ StyleFontStretchFixedPoint{ /* .value = */ (75 << StyleFontStretch::FRACTION_BITS) } };
6047/// The `semi-condensed` keyword.
6048constexpr inline const StyleFontStretch StyleFontStretch::SEMI_CONDENSED = StyleFontStretch{ /* ._0 = */ StyleFontStretchFixedPoint{ /* .value = */ ((87 << StyleFontStretch::FRACTION_BITS) + StyleFontStretch::HALF) } };
6049/// The `normal` keyword.
6050constexpr inline const StyleFontStretch StyleFontStretch::NORMAL = StyleFontStretch{ /* ._0 = */ StyleFontStretchFixedPoint{ /* .value = */ (100 << StyleFontStretch::FRACTION_BITS) } };
6051/// The `semi-expanded` keyword.
6052constexpr inline const StyleFontStretch StyleFontStretch::SEMI_EXPANDED = StyleFontStretch{ /* ._0 = */ StyleFontStretchFixedPoint{ /* .value = */ ((112 << StyleFontStretch::FRACTION_BITS) + StyleFontStretch::HALF) } };
6053/// The `expanded` keyword.
6054constexpr inline const StyleFontStretch StyleFontStretch::EXPANDED = StyleFontStretch{ /* ._0 = */ StyleFontStretchFixedPoint{ /* .value = */ (125 << StyleFontStretch::FRACTION_BITS) } };
6055/// The `extra-expanded` keyword.
6056constexpr inline const StyleFontStretch StyleFontStretch::EXTRA_EXPANDED = StyleFontStretch{ /* ._0 = */ StyleFontStretchFixedPoint{ /* .value = */ (150 << StyleFontStretch::FRACTION_BITS) } };
6057/// The `ultra-expanded` keyword.
6058constexpr inline const StyleFontStretch StyleFontStretch::ULTRA_EXPANDED = StyleFontStretch{ /* ._0 = */ StyleFontStretchFixedPoint{ /* .value = */ (200 << StyleFontStretch::FRACTION_BITS) } };
6059
6060/// The computed representation of the above, so that Gecko can read them
6061/// easily.
6062struct StyleComputedFontStretchRange {
6063 StyleFontStretch _0;
6064 StyleFontStretch _1;
6065
6066 bool operator==(const StyleComputedFontStretchRange& other) const {
6067 return _0 == other._0 &&
6068 _1 == other._1;
6069 }
6070 bool operator!=(const StyleComputedFontStretchRange& other) const {
6071 return _0 != other._0 ||
6072 _1 != other._1;
6073 }
6074};
6075
6076/// The computed representation of the above, with angles in degrees, so that
6077/// Gecko can read them easily.
6078union StyleComputedFontStyleDescriptor {
6079 enum class Tag : uint8_t {
6080 Normal,
6081 Italic,
6082 Oblique,
6083 };
6084
6085 struct Oblique_Body {
6086 Tag tag;
6087 float _0;
6088 float _1;
6089
6090 bool operator==(const Oblique_Body& other) const {
6091 return _0 == other._0 &&
6092 _1 == other._1;
6093 }
6094 bool operator!=(const Oblique_Body& other) const {
6095 return _0 != other._0 ||
6096 _1 != other._1;
6097 }
6098 };
6099
6100 struct {
6101 Tag tag;
6102 };
6103 Oblique_Body oblique;
6104
6105 static StyleComputedFontStyleDescriptor Normal() {
6106 StyleComputedFontStyleDescriptor result;
6107 result.tag = Tag::Normal;
6108 return result;
6109 }
6110
6111 bool IsNormal() const {
6112 return tag == Tag::Normal;
6113 }
6114
6115 static StyleComputedFontStyleDescriptor Italic() {
6116 StyleComputedFontStyleDescriptor result;
6117 result.tag = Tag::Italic;
6118 return result;
6119 }
6120
6121 bool IsItalic() const {
6122 return tag == Tag::Italic;
6123 }
6124
6125 static StyleComputedFontStyleDescriptor Oblique(const float &_0,
6126 const float &_1) {
6127 StyleComputedFontStyleDescriptor result;
6128 ::new (&result.oblique._0) (float)(_0);
6129 ::new (&result.oblique._1) (float)(_1);
6130 result.tag = Tag::Oblique;
6131 return result;
6132 }
6133
6134 bool IsOblique() const {
6135 return tag == Tag::Oblique;
6136 }
6137
6138 const Oblique_Body& AsOblique() const {
6139 MOZ_DIAGNOSTIC_ASSERT(IsOblique())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsOblique())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsOblique()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsOblique()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 6139); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsOblique()"
")"); do { *((volatile int*)__null) = 6139; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
6140 return oblique;
6141 }
6142
6143 bool operator==(const StyleComputedFontStyleDescriptor& other) const {
6144 if (tag != other.tag) {
6145 return false;
6146 }
6147 switch (tag) {
6148 case Tag::Oblique: return oblique == other.oblique;
6149 default: break;
6150 }
6151 return true;
6152 }
6153
6154 bool operator!=(const StyleComputedFontStyleDescriptor& other) const {
6155 return !(*this == other);
6156 }
6157
6158 private:
6159 StyleComputedFontStyleDescriptor() {
6160
6161 }
6162 public:
6163
6164
6165 ~StyleComputedFontStyleDescriptor() {
6166 switch (tag) {
6167 case Tag::Oblique: oblique.~Oblique_Body(); break;
6168 default: break;
6169 }
6170 }
6171
6172 StyleComputedFontStyleDescriptor(const StyleComputedFontStyleDescriptor& other)
6173 : tag(other.tag) {
6174 switch (tag) {
6175 case Tag::Oblique: ::new (&oblique) (Oblique_Body)(other.oblique); break;
6176 default: break;
6177 }
6178 }
6179 StyleComputedFontStyleDescriptor& operator=(const StyleComputedFontStyleDescriptor& other) {
6180 if (this != &other) {
6181 this->~StyleComputedFontStyleDescriptor();
6182 new (this) StyleComputedFontStyleDescriptor(other);
6183 }
6184 return *this;
6185 }
6186};
6187
6188/// font-language-override can only have a single 1-4 ASCII character
6189/// OpenType "language system" tag, so we should be able to compute
6190/// it and store it as a 32-bit integer
6191/// (see http://www.microsoft.com/typography/otspec/languagetags.htm).
6192struct StyleFontLanguageOverride {
6193 uint32_t _0;
6194
6195 bool operator==(const StyleFontLanguageOverride& other) const {
6196 return _0 == other._0;
6197 }
6198 bool operator!=(const StyleFontLanguageOverride& other) const {
6199 return _0 != other._0;
6200 }
6201};
6202
6203/// One contiguous range of code points.
6204///
6205/// Can not be empty. Can represent a single code point when start == end.
6206struct StyleUnicodeRange {
6207 /// Inclusive start of the range. In [0, end].
6208 uint32_t start;
6209 /// Inclusive end of the range. In [0, 0x10FFFF].
6210 uint32_t end;
6211
6212 bool operator==(const StyleUnicodeRange& other) const {
6213 return start == other.start &&
6214 end == other.end;
6215 }
6216 bool operator!=(const StyleUnicodeRange& other) const {
6217 return start != other.start ||
6218 end != other.end;
6219 }
6220};
6221
6222/// Flags for the @font-face tech() function, indicating font technologies
6223/// required by the resource.
6224struct StyleFontFaceSourceTechFlags {
6225 uint16_t _0;
6226
6227 constexpr explicit operator bool() const {
6228 return !!_0;
6229 }
6230 constexpr StyleFontFaceSourceTechFlags operator~() const {
6231 return StyleFontFaceSourceTechFlags { static_cast<decltype(_0)>(~_0) };
6232 }
6233 constexpr StyleFontFaceSourceTechFlags operator|(const StyleFontFaceSourceTechFlags& other) const {
6234 return StyleFontFaceSourceTechFlags { static_cast<decltype(_0)>(this->_0 | other._0) };
6235 }
6236 StyleFontFaceSourceTechFlags& operator|=(const StyleFontFaceSourceTechFlags& other) {
6237 *this = (*this | other);
6238 return *this;
6239 }
6240 constexpr StyleFontFaceSourceTechFlags operator&(const StyleFontFaceSourceTechFlags& other) const {
6241 return StyleFontFaceSourceTechFlags { static_cast<decltype(_0)>(this->_0 & other._0) };
6242 }
6243 StyleFontFaceSourceTechFlags& operator&=(const StyleFontFaceSourceTechFlags& other) {
6244 *this = (*this & other);
6245 return *this;
6246 }
6247 constexpr StyleFontFaceSourceTechFlags operator^(const StyleFontFaceSourceTechFlags& other) const {
6248 return StyleFontFaceSourceTechFlags { static_cast<decltype(_0)>(this->_0 ^ other._0) };
6249 }
6250 StyleFontFaceSourceTechFlags& operator^=(const StyleFontFaceSourceTechFlags& other) {
6251 *this = (*this ^ other);
6252 return *this;
6253 }
6254 bool operator==(const StyleFontFaceSourceTechFlags& other) const {
6255 return _0 == other._0;
6256 }
6257 bool operator!=(const StyleFontFaceSourceTechFlags& other) const {
6258 return _0 != other._0;
6259 }
6260 inline static StyleFontFaceSourceTechFlags Empty() {
6261 return StyleFontFaceSourceTechFlags{0};
6262 }
6263 static const StyleFontFaceSourceTechFlags FEATURES_OPENTYPE;
6264 static const StyleFontFaceSourceTechFlags FEATURES_AAT;
6265 static const StyleFontFaceSourceTechFlags FEATURES_GRAPHITE;
6266 static const StyleFontFaceSourceTechFlags COLOR_COLRV0;
6267 static const StyleFontFaceSourceTechFlags COLOR_COLRV1;
6268 static const StyleFontFaceSourceTechFlags COLOR_SVG;
6269 static const StyleFontFaceSourceTechFlags COLOR_SBIX;
6270 static const StyleFontFaceSourceTechFlags COLOR_CBDT;
6271 static const StyleFontFaceSourceTechFlags VARIATIONS;
6272 static const StyleFontFaceSourceTechFlags PALETTES;
6273 static const StyleFontFaceSourceTechFlags INCREMENTAL;
6274};
6275/// Font requires OpenType feature support.
6276constexpr inline const StyleFontFaceSourceTechFlags StyleFontFaceSourceTechFlags::FEATURES_OPENTYPE = StyleFontFaceSourceTechFlags{ /* ._0 = */ (uint16_t)(1 << 0) };
6277/// Font requires Apple Advanced Typography support.
6278constexpr inline const StyleFontFaceSourceTechFlags StyleFontFaceSourceTechFlags::FEATURES_AAT = StyleFontFaceSourceTechFlags{ /* ._0 = */ (uint16_t)(1 << 1) };
6279/// Font requires Graphite shaping support.
6280constexpr inline const StyleFontFaceSourceTechFlags StyleFontFaceSourceTechFlags::FEATURES_GRAPHITE = StyleFontFaceSourceTechFlags{ /* ._0 = */ (uint16_t)(1 << 2) };
6281/// Font requires COLRv0 rendering support (simple list of colored layers).
6282constexpr inline const StyleFontFaceSourceTechFlags StyleFontFaceSourceTechFlags::COLOR_COLRV0 = StyleFontFaceSourceTechFlags{ /* ._0 = */ (uint16_t)(1 << 3) };
6283/// Font requires COLRv1 rendering support (graph of paint operations).
6284constexpr inline const StyleFontFaceSourceTechFlags StyleFontFaceSourceTechFlags::COLOR_COLRV1 = StyleFontFaceSourceTechFlags{ /* ._0 = */ (uint16_t)(1 << 4) };
6285/// Font requires SVG glyph rendering support.
6286constexpr inline const StyleFontFaceSourceTechFlags StyleFontFaceSourceTechFlags::COLOR_SVG = StyleFontFaceSourceTechFlags{ /* ._0 = */ (uint16_t)(1 << 5) };
6287/// Font has bitmap glyphs in 'sbix' format.
6288constexpr inline const StyleFontFaceSourceTechFlags StyleFontFaceSourceTechFlags::COLOR_SBIX = StyleFontFaceSourceTechFlags{ /* ._0 = */ (uint16_t)(1 << 6) };
6289/// Font has bitmap glyphs in 'CBDT' format.
6290constexpr inline const StyleFontFaceSourceTechFlags StyleFontFaceSourceTechFlags::COLOR_CBDT = StyleFontFaceSourceTechFlags{ /* ._0 = */ (uint16_t)(1 << 7) };
6291/// Font requires OpenType Variations support.
6292constexpr inline const StyleFontFaceSourceTechFlags StyleFontFaceSourceTechFlags::VARIATIONS = StyleFontFaceSourceTechFlags{ /* ._0 = */ (uint16_t)(1 << 8) };
6293/// Font requires CPAL palette selection support.
6294constexpr inline const StyleFontFaceSourceTechFlags StyleFontFaceSourceTechFlags::PALETTES = StyleFontFaceSourceTechFlags{ /* ._0 = */ (uint16_t)(1 << 9) };
6295/// Font requires support for incremental downloading.
6296constexpr inline const StyleFontFaceSourceTechFlags StyleFontFaceSourceTechFlags::INCREMENTAL = StyleFontFaceSourceTechFlags{ /* ._0 = */ (uint16_t)(1 << 10) };
6297
6298#if defined(CBINDGEN_IS_GECKO)
6299/// A POD representation for Gecko. All pointers here are non-owned and as such
6300/// can't outlive the rule they came from, but we can't enforce that via C++.
6301///
6302/// All the strings are of course utf8.
6303union StyleFontFaceSourceListComponent {
6304 enum class Tag : uint8_t {
6305 Url,
6306 Local,
6307 FormatHintKeyword,
6308 FormatHintString,
6309 TechFlags,
6310 };
6311
6312 struct Url_Body {
6313 Tag tag;
6314 const StyleCssUrl *_0;
6315
6316 bool operator==(const Url_Body& other) const {
6317 return _0 == other._0;
6318 }
6319 bool operator!=(const Url_Body& other) const {
6320 return _0 != other._0;
6321 }
6322 };
6323
6324 struct Local_Body {
6325 Tag tag;
6326 nsAtom *_0;
6327
6328 bool operator==(const Local_Body& other) const {
6329 return _0 == other._0;
6330 }
6331 bool operator!=(const Local_Body& other) const {
6332 return _0 != other._0;
6333 }
6334 };
6335
6336 struct FormatHintKeyword_Body {
6337 Tag tag;
6338 StyleFontFaceSourceFormatKeyword _0;
6339
6340 bool operator==(const FormatHintKeyword_Body& other) const {
6341 return _0 == other._0;
6342 }
6343 bool operator!=(const FormatHintKeyword_Body& other) const {
6344 return _0 != other._0;
6345 }
6346 };
6347
6348 struct FormatHintString_Body {
6349 Tag tag;
6350 uintptr_t length;
6351 const uint8_t *utf8_bytes;
6352
6353 bool operator==(const FormatHintString_Body& other) const {
6354 return length == other.length &&
6355 utf8_bytes == other.utf8_bytes;
6356 }
6357 bool operator!=(const FormatHintString_Body& other) const {
6358 return length != other.length ||
6359 utf8_bytes != other.utf8_bytes;
6360 }
6361 };
6362
6363 struct TechFlags_Body {
6364 Tag tag;
6365 StyleFontFaceSourceTechFlags _0;
6366
6367 bool operator==(const TechFlags_Body& other) const {
6368 return _0 == other._0;
6369 }
6370 bool operator!=(const TechFlags_Body& other) const {
6371 return _0 != other._0;
6372 }
6373 };
6374
6375 struct {
6376 Tag tag;
6377 };
6378 Url_Body url;
6379 Local_Body local;
6380 FormatHintKeyword_Body format_hint_keyword;
6381 FormatHintString_Body format_hint_string;
6382 TechFlags_Body tech_flags;
6383
6384 static StyleFontFaceSourceListComponent Url(const StyleCssUrl *const &_0) {
6385 StyleFontFaceSourceListComponent result;
6386 ::new (&result.url._0) (const StyleCssUrl*)(_0);
6387 result.tag = Tag::Url;
6388 return result;
6389 }
6390
6391 bool IsUrl() const {
6392 return tag == Tag::Url;
6393 }
6394
6395 const StyleCssUrl*const & AsUrl() const {
6396 MOZ_DIAGNOSTIC_ASSERT(IsUrl())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsUrl())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsUrl()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsUrl()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 6396); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsUrl()"
")"); do { *((volatile int*)__null) = 6396; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
6397 return url._0;
6398 }
6399
6400 static StyleFontFaceSourceListComponent Local(nsAtom *const &_0) {
6401 StyleFontFaceSourceListComponent result;
6402 ::new (&result.local._0) (nsAtom*)(_0);
6403 result.tag = Tag::Local;
6404 return result;
6405 }
6406
6407 bool IsLocal() const {
6408 return tag == Tag::Local;
6409 }
6410
6411 nsAtom*const & AsLocal() const {
6412 MOZ_DIAGNOSTIC_ASSERT(IsLocal())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLocal())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLocal()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLocal()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 6412); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLocal()"
")"); do { *((volatile int*)__null) = 6412; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
6413 return local._0;
6414 }
6415
6416 static StyleFontFaceSourceListComponent FormatHintKeyword(const StyleFontFaceSourceFormatKeyword &_0) {
6417 StyleFontFaceSourceListComponent result;
6418 ::new (&result.format_hint_keyword._0) (StyleFontFaceSourceFormatKeyword)(_0);
6419 result.tag = Tag::FormatHintKeyword;
6420 return result;
6421 }
6422
6423 bool IsFormatHintKeyword() const {
6424 return tag == Tag::FormatHintKeyword;
6425 }
6426
6427 const StyleFontFaceSourceFormatKeyword& AsFormatHintKeyword() const {
6428 MOZ_DIAGNOSTIC_ASSERT(IsFormatHintKeyword())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsFormatHintKeyword())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsFormatHintKeyword()))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("IsFormatHintKeyword()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 6428); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsFormatHintKeyword()"
")"); do { *((volatile int*)__null) = 6428; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
6429 return format_hint_keyword._0;
6430 }
6431
6432 static StyleFontFaceSourceListComponent FormatHintString(const uintptr_t &length,
6433 const uint8_t *const &utf8_bytes) {
6434 StyleFontFaceSourceListComponent result;
6435 ::new (&result.format_hint_string.length) (uintptr_t)(length);
6436 ::new (&result.format_hint_string.utf8_bytes) (const uint8_t*)(utf8_bytes);
6437 result.tag = Tag::FormatHintString;
6438 return result;
6439 }
6440
6441 bool IsFormatHintString() const {
6442 return tag == Tag::FormatHintString;
6443 }
6444
6445 const FormatHintString_Body& AsFormatHintString() const {
6446 MOZ_DIAGNOSTIC_ASSERT(IsFormatHintString())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsFormatHintString())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsFormatHintString()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsFormatHintString()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 6446); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsFormatHintString()"
")"); do { *((volatile int*)__null) = 6446; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
6447 return format_hint_string;
6448 }
6449
6450 static StyleFontFaceSourceListComponent TechFlags(const StyleFontFaceSourceTechFlags &_0) {
6451 StyleFontFaceSourceListComponent result;
6452 ::new (&result.tech_flags._0) (StyleFontFaceSourceTechFlags)(_0);
6453 result.tag = Tag::TechFlags;
6454 return result;
6455 }
6456
6457 bool IsTechFlags() const {
6458 return tag == Tag::TechFlags;
6459 }
6460
6461 const StyleFontFaceSourceTechFlags& AsTechFlags() const {
6462 MOZ_DIAGNOSTIC_ASSERT(IsTechFlags())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTechFlags())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTechFlags()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsTechFlags()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 6462); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTechFlags()"
")"); do { *((volatile int*)__null) = 6462; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
6463 return tech_flags._0;
6464 }
6465
6466 bool operator==(const StyleFontFaceSourceListComponent& other) const {
6467 if (tag != other.tag) {
6468 return false;
6469 }
6470 switch (tag) {
6471 case Tag::Url: return url == other.url;
6472 case Tag::Local: return local == other.local;
6473 case Tag::FormatHintKeyword: return format_hint_keyword == other.format_hint_keyword;
6474 case Tag::FormatHintString: return format_hint_string == other.format_hint_string;
6475 case Tag::TechFlags: return tech_flags == other.tech_flags;
6476
6477 }
6478 return true;
6479 }
6480
6481 bool operator!=(const StyleFontFaceSourceListComponent& other) const {
6482 return !(*this == other);
6483 }
6484
6485 private:
6486 StyleFontFaceSourceListComponent() {
6487
6488 }
6489 public:
6490
6491
6492 ~StyleFontFaceSourceListComponent() {
6493 switch (tag) {
6494 case Tag::Url: url.~Url_Body(); break;
6495 case Tag::Local: local.~Local_Body(); break;
6496 case Tag::FormatHintKeyword: format_hint_keyword.~FormatHintKeyword_Body(); break;
6497 case Tag::FormatHintString: format_hint_string.~FormatHintString_Body(); break;
6498 case Tag::TechFlags: tech_flags.~TechFlags_Body(); break;
6499
6500 }
6501 }
6502
6503 StyleFontFaceSourceListComponent(const StyleFontFaceSourceListComponent& other)
6504 : tag(other.tag) {
6505 switch (tag) {
6506 case Tag::Url: ::new (&url) (Url_Body)(other.url); break;
6507 case Tag::Local: ::new (&local) (Local_Body)(other.local); break;
6508 case Tag::FormatHintKeyword: ::new (&format_hint_keyword) (FormatHintKeyword_Body)(other.format_hint_keyword); break;
6509 case Tag::FormatHintString: ::new (&format_hint_string) (FormatHintString_Body)(other.format_hint_string); break;
6510 case Tag::TechFlags: ::new (&tech_flags) (TechFlags_Body)(other.tech_flags); break;
6511
6512 }
6513 }
6514 StyleFontFaceSourceListComponent& operator=(const StyleFontFaceSourceListComponent& other) {
6515 if (this != &other) {
6516 this->~StyleFontFaceSourceListComponent();
6517 new (this) StyleFontFaceSourceListComponent(other);
6518 }
6519 return *this;
6520 }
6521};
6522#endif
6523
6524#if defined(CBINDGEN_IS_GECKO)
6525/// A handle to a Gecko atom. This is a type that can represent either:
6526///
6527/// * A strong reference to a dynamic atom (an `nsAtom` pointer), in which case
6528/// the `usize` just holds the pointer value.
6529///
6530/// * An index from `gGkAtoms` to the `nsStaticAtom` object (shifted to the left one bit, and with
6531/// the lower bit set to `1` to differentiate it from the above), so `(index << 1 | 1)`.
6532///
6533struct StyleAtom {
6534 StyleNonZeroUsize _0;
6535
6536 bool operator==(const StyleAtom& other) const {
6537 return _0 == other._0;
6538 }
6539 bool operator!=(const StyleAtom& other) const {
6540 return _0 != other._0;
6541 }
6542 StyleAtom(size_t) = delete;
6543 StyleAtom() = delete;
6544
6545 inline bool IsStatic() const;
6546 inline nsAtom* AsAtom() const;
6547
6548 private:
6549 inline void AddRef();
6550 inline void Release();
6551
6552 public:
6553 inline explicit StyleAtom(already_AddRefed<nsAtom>);
6554 inline explicit StyleAtom(nsStaticAtom*);
6555 inline StyleAtom(const StyleAtom& aOther);
6556 inline StyleAtom& operator=(const StyleAtom&);
6557 inline ~StyleAtom();
6558};
6559#endif
6560
6561/// <https://drafts.csswg.org/css-values-4/#custom-idents>
6562struct StyleCustomIdent {
6563 StyleAtom _0;
6564
6565 bool operator==(const StyleCustomIdent& other) const {
6566 return _0 == other._0;
6567 }
6568 bool operator!=(const StyleCustomIdent& other) const {
6569 return _0 != other._0;
6570 }
6571 inline nsAtom* AsAtom() const;
6572};
6573
6574/// <https://drafts.csswg.org/css-counter-styles/#typedef-symbol>
6575union StyleSymbol {
6576 enum class Tag : uint8_t {
6577 /// <string>
6578 String,
6579 /// <custom-ident>
6580 Ident,
6581 };
6582
6583 struct String_Body {
6584 Tag tag;
6585 StyleOwnedStr _0;
6586
6587 bool operator==(const String_Body& other) const {
6588 return _0 == other._0;
6589 }
6590 bool operator!=(const String_Body& other) const {
6591 return _0 != other._0;
6592 }
6593 };
6594
6595 struct Ident_Body {
6596 Tag tag;
6597 StyleCustomIdent _0;
6598
6599 bool operator==(const Ident_Body& other) const {
6600 return _0 == other._0;
6601 }
6602 bool operator!=(const Ident_Body& other) const {
6603 return _0 != other._0;
6604 }
6605 };
6606
6607 struct {
6608 Tag tag;
6609 };
6610 String_Body string;
6611 Ident_Body ident;
6612
6613 static StyleSymbol String(const StyleOwnedStr &_0) {
6614 StyleSymbol result;
6615 ::new (&result.string._0) (StyleOwnedStr)(_0);
6616 result.tag = Tag::String;
6617 return result;
6618 }
6619
6620 bool IsString() const {
6621 return tag == Tag::String;
6622 }
6623
6624 const StyleOwnedStr& AsString() const {
6625 MOZ_DIAGNOSTIC_ASSERT(IsString())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsString())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsString()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsString()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 6625); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsString()"
")"); do { *((volatile int*)__null) = 6625; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
6626 return string._0;
6627 }
6628
6629 static StyleSymbol Ident(const StyleCustomIdent &_0) {
6630 StyleSymbol result;
6631 ::new (&result.ident._0) (StyleCustomIdent)(_0);
6632 result.tag = Tag::Ident;
6633 return result;
6634 }
6635
6636 bool IsIdent() const {
6637 return tag == Tag::Ident;
6638 }
6639
6640 const StyleCustomIdent& AsIdent() const {
6641 MOZ_DIAGNOSTIC_ASSERT(IsIdent())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsIdent())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsIdent()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsIdent()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 6641); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsIdent()"
")"); do { *((volatile int*)__null) = 6641; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
6642 return ident._0;
6643 }
6644
6645 bool operator==(const StyleSymbol& other) const {
6646 if (tag != other.tag) {
6647 return false;
6648 }
6649 switch (tag) {
6650 case Tag::String: return string == other.string;
6651 case Tag::Ident: return ident == other.ident;
6652
6653 }
6654 return true;
6655 }
6656
6657 bool operator!=(const StyleSymbol& other) const {
6658 return !(*this == other);
6659 }
6660
6661 private:
6662 StyleSymbol() {
6663
6664 }
6665 public:
6666
6667
6668 ~StyleSymbol() {
6669 switch (tag) {
6670 case Tag::String: string.~String_Body(); break;
6671 case Tag::Ident: ident.~Ident_Body(); break;
6672
6673 }
6674 }
6675
6676 StyleSymbol(const StyleSymbol& other)
6677 : tag(other.tag) {
6678 switch (tag) {
6679 case Tag::String: ::new (&string) (String_Body)(other.string); break;
6680 case Tag::Ident: ::new (&ident) (Ident_Body)(other.ident); break;
6681
6682 }
6683 }
6684 StyleSymbol& operator=(const StyleSymbol& other) {
6685 if (this != &other) {
6686 this->~StyleSymbol();
6687 new (this) StyleSymbol(other);
6688 }
6689 return *this;
6690 }
6691};
6692
6693struct StyleAdditiveSymbol {
6694 int32_t weight;
6695 nsString symbol;
6696
6697 bool operator==(const StyleAdditiveSymbol& other) const {
6698 return weight == other.weight &&
6699 symbol == other.symbol;
6700 }
6701 bool operator!=(const StyleAdditiveSymbol& other) const {
6702 return weight != other.weight ||
6703 symbol != other.symbol;
6704 }
6705};
6706
6707struct StyleCounterSpeakAs {
6708 enum class Tag : uint8_t {
6709 None,
6710 Auto,
6711 Bullets,
6712 Numbers,
6713 Words,
6714 Ident,
6715 };
6716
6717 struct StyleIdent_Body {
6718 nsAtom *_0;
6719
6720 bool operator==(const StyleIdent_Body& other) const {
6721 return _0 == other._0;
6722 }
6723 bool operator!=(const StyleIdent_Body& other) const {
6724 return _0 != other._0;
6725 }
6726 };
6727
6728 Tag tag;
6729 union {
6730 StyleIdent_Body ident;
6731 };
6732
6733 static StyleCounterSpeakAs None() {
6734 StyleCounterSpeakAs result;
6735 result.tag = Tag::None;
6736 return result;
6737 }
6738
6739 bool IsNone() const {
6740 return tag == Tag::None;
6741 }
6742
6743 static StyleCounterSpeakAs Auto() {
6744 StyleCounterSpeakAs result;
6745 result.tag = Tag::Auto;
6746 return result;
6747 }
6748
6749 bool IsAuto() const {
6750 return tag == Tag::Auto;
6751 }
6752
6753 static StyleCounterSpeakAs Bullets() {
6754 StyleCounterSpeakAs result;
6755 result.tag = Tag::Bullets;
6756 return result;
6757 }
6758
6759 bool IsBullets() const {
6760 return tag == Tag::Bullets;
6761 }
6762
6763 static StyleCounterSpeakAs Numbers() {
6764 StyleCounterSpeakAs result;
6765 result.tag = Tag::Numbers;
6766 return result;
6767 }
6768
6769 bool IsNumbers() const {
6770 return tag == Tag::Numbers;
6771 }
6772
6773 static StyleCounterSpeakAs Words() {
6774 StyleCounterSpeakAs result;
6775 result.tag = Tag::Words;
6776 return result;
6777 }
6778
6779 bool IsWords() const {
6780 return tag == Tag::Words;
6781 }
6782
6783 static StyleCounterSpeakAs Ident(nsAtom *const &_0) {
6784 StyleCounterSpeakAs result;
6785 ::new (&result.ident._0) (nsAtom*)(_0);
6786 result.tag = Tag::Ident;
6787 return result;
6788 }
6789
6790 bool IsIdent() const {
6791 return tag == Tag::Ident;
6792 }
6793
6794 nsAtom*const & AsIdent() const {
6795 MOZ_DIAGNOSTIC_ASSERT(IsIdent())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsIdent())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsIdent()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsIdent()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 6795); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsIdent()"
")"); do { *((volatile int*)__null) = 6795; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
6796 return ident._0;
6797 }
6798
6799 bool operator==(const StyleCounterSpeakAs& other) const {
6800 if (tag != other.tag) {
6801 return false;
6802 }
6803 switch (tag) {
6804 case Tag::Ident: return ident == other.ident;
6805 default: break;
6806 }
6807 return true;
6808 }
6809
6810 bool operator!=(const StyleCounterSpeakAs& other) const {
6811 return !(*this == other);
6812 }
6813
6814 private:
6815 StyleCounterSpeakAs() {
6816
6817 }
6818 public:
6819
6820
6821 ~StyleCounterSpeakAs() {
6822 switch (tag) {
6823 case Tag::Ident: ident.~StyleIdent_Body(); break;
6824 default: break;
6825 }
6826 }
6827
6828 StyleCounterSpeakAs(const StyleCounterSpeakAs& other)
6829 : tag(other.tag) {
6830 switch (tag) {
6831 case Tag::Ident: ::new (&ident) (StyleIdent_Body)(other.ident); break;
6832 default: break;
6833 }
6834 }
6835 StyleCounterSpeakAs& operator=(const StyleCounterSpeakAs& other) {
6836 if (this != &other) {
6837 this->~StyleCounterSpeakAs();
6838 new (this) StyleCounterSpeakAs(other);
6839 }
6840 return *this;
6841 }
6842};
6843
6844/// Bit-flags for pseudo-class. This should only be used for querying if a
6845/// page-rule applies.
6846///
6847/// https://drafts.csswg.org/css-page-3/#page-selectors
6848struct StylePagePseudoClassFlags {
6849 uint8_t bits;
6850
6851 constexpr explicit operator bool() const {
6852 return !!bits;
6853 }
6854 constexpr StylePagePseudoClassFlags operator~() const {
6855 return StylePagePseudoClassFlags { static_cast<decltype(bits)>(~bits) };
6856 }
6857 constexpr StylePagePseudoClassFlags operator|(const StylePagePseudoClassFlags& other) const {
6858 return StylePagePseudoClassFlags { static_cast<decltype(bits)>(this->bits | other.bits) };
6859 }
6860 StylePagePseudoClassFlags& operator|=(const StylePagePseudoClassFlags& other) {
6861 *this = (*this | other);
6862 return *this;
6863 }
6864 constexpr StylePagePseudoClassFlags operator&(const StylePagePseudoClassFlags& other) const {
6865 return StylePagePseudoClassFlags { static_cast<decltype(bits)>(this->bits & other.bits) };
6866 }
6867 StylePagePseudoClassFlags& operator&=(const StylePagePseudoClassFlags& other) {
6868 *this = (*this & other);
6869 return *this;
6870 }
6871 constexpr StylePagePseudoClassFlags operator^(const StylePagePseudoClassFlags& other) const {
6872 return StylePagePseudoClassFlags { static_cast<decltype(bits)>(this->bits ^ other.bits) };
6873 }
6874 StylePagePseudoClassFlags& operator^=(const StylePagePseudoClassFlags& other) {
6875 *this = (*this ^ other);
6876 return *this;
6877 }
6878 bool operator==(const StylePagePseudoClassFlags& other) const {
6879 return bits == other.bits;
6880 }
6881 bool operator!=(const StylePagePseudoClassFlags& other) const {
6882 return bits != other.bits;
6883 }
6884 static const StylePagePseudoClassFlags NONE;
6885 static const StylePagePseudoClassFlags FIRST;
6886 static const StylePagePseudoClassFlags BLANK;
6887 static const StylePagePseudoClassFlags LEFT;
6888 static const StylePagePseudoClassFlags RIGHT;
6889};
6890/// No pseudo-classes
6891constexpr inline const StylePagePseudoClassFlags StylePagePseudoClassFlags::NONE = StylePagePseudoClassFlags{ /* .bits = */ (uint8_t)0 };
6892/// Flag for PagePseudoClass::First
6893constexpr inline const StylePagePseudoClassFlags StylePagePseudoClassFlags::FIRST = StylePagePseudoClassFlags{ /* .bits = */ (uint8_t)(1 << 0) };
6894/// Flag for PagePseudoClass::Blank
6895constexpr inline const StylePagePseudoClassFlags StylePagePseudoClassFlags::BLANK = StylePagePseudoClassFlags{ /* .bits = */ (uint8_t)(1 << 1) };
6896/// Flag for PagePseudoClass::Left
6897constexpr inline const StylePagePseudoClassFlags StylePagePseudoClassFlags::LEFT = StylePagePseudoClassFlags{ /* .bits = */ (uint8_t)(1 << 2) };
6898/// Flag for PagePseudoClass::Right
6899constexpr inline const StylePagePseudoClassFlags StylePagePseudoClassFlags::RIGHT = StylePagePseudoClassFlags{ /* .bits = */ (uint8_t)(1 << 3) };
6900
6901/// The mode to use when parsing values.
6902struct StyleParsingMode {
6903 uint8_t bits;
6904
6905 constexpr explicit operator bool() const {
6906 return !!bits;
6907 }
6908 constexpr StyleParsingMode operator~() const {
6909 return StyleParsingMode { static_cast<decltype(bits)>(~bits) };
6910 }
6911 constexpr StyleParsingMode operator|(const StyleParsingMode& other) const {
6912 return StyleParsingMode { static_cast<decltype(bits)>(this->bits | other.bits) };
6913 }
6914 StyleParsingMode& operator|=(const StyleParsingMode& other) {
6915 *this = (*this | other);
6916 return *this;
6917 }
6918 constexpr StyleParsingMode operator&(const StyleParsingMode& other) const {
6919 return StyleParsingMode { static_cast<decltype(bits)>(this->bits & other.bits) };
6920 }
6921 StyleParsingMode& operator&=(const StyleParsingMode& other) {
6922 *this = (*this & other);
6923 return *this;
6924 }
6925 constexpr StyleParsingMode operator^(const StyleParsingMode& other) const {
6926 return StyleParsingMode { static_cast<decltype(bits)>(this->bits ^ other.bits) };
6927 }
6928 StyleParsingMode& operator^=(const StyleParsingMode& other) {
6929 *this = (*this ^ other);
6930 return *this;
6931 }
6932 bool operator==(const StyleParsingMode& other) const {
6933 return bits == other.bits;
6934 }
6935 bool operator!=(const StyleParsingMode& other) const {
6936 return bits != other.bits;
6937 }
6938 static const StyleParsingMode DEFAULT;
6939 static const StyleParsingMode ALLOW_UNITLESS_LENGTH;
6940 static const StyleParsingMode ALLOW_ALL_NUMERIC_VALUES;
6941 static const StyleParsingMode DISALLOW_COMPUTATIONALLY_DEPENDENT;
6942};
6943/// In CSS; lengths must have units, except for zero values, where the unit can be omitted.
6944/// <https://www.w3.org/TR/css3-values/#lengths>
6945constexpr inline const StyleParsingMode StyleParsingMode::DEFAULT = StyleParsingMode{ /* .bits = */ (uint8_t)0 };
6946/// In SVG; a coordinate or length value without a unit identifier (e.g., "25") is assumed
6947/// to be in user units (px).
6948/// <https://www.w3.org/TR/SVG/coords.html#Units>
6949constexpr inline const StyleParsingMode StyleParsingMode::ALLOW_UNITLESS_LENGTH = StyleParsingMode{ /* .bits = */ (uint8_t)1 };
6950/// In SVG; out-of-range values are not treated as an error in parsing.
6951/// <https://www.w3.org/TR/SVG/implnote.html#RangeClamping>
6952constexpr inline const StyleParsingMode StyleParsingMode::ALLOW_ALL_NUMERIC_VALUES = StyleParsingMode{ /* .bits = */ (uint8_t)(1 << 1) };
6953/// In CSS Properties and Values, the initial value must be computationally
6954/// independent.
6955/// <https://drafts.css-houdini.org/css-properties-values-api-1/#ref-for-computationally-independent%E2%91%A0>
6956constexpr inline const StyleParsingMode StyleParsingMode::DISALLOW_COMPUTATIONALLY_DEPENDENT = StyleParsingMode{ /* .bits = */ (uint8_t)(1 << 2) };
6957
6958using StyleValueType = StyleCSSFloat;
6959
6960/// a single entry in a piecewise linear function.
6961struct StylePiecewiseLinearFunctionEntry {
6962 StyleValueType x;
6963 StyleValueType y;
6964
6965 bool operator==(const StylePiecewiseLinearFunctionEntry& other) const {
6966 return x == other.x &&
6967 y == other.y;
6968 }
6969 bool operator!=(const StylePiecewiseLinearFunctionEntry& other) const {
6970 return x != other.x ||
6971 y != other.y;
6972 }
6973};
6974
6975/// Representation of a piecewise linear function, a series of linear functions.
6976struct StylePiecewiseLinearFunction {
6977 StyleArcSlice<StylePiecewiseLinearFunctionEntry> entries;
6978
6979 bool operator==(const StylePiecewiseLinearFunction& other) const {
6980 return entries == other.entries;
6981 }
6982 bool operator!=(const StylePiecewiseLinearFunction& other) const {
6983 return entries != other.entries;
6984 }
6985};
6986
6987/// A generic easing function.
6988template<typename Integer, typename Number, typename LinearStops>
6989struct StyleTimingFunction {
6990 enum class Tag : uint8_t {
6991 /// `linear | ease | ease-in | ease-out | ease-in-out`
6992 Keyword,
6993 /// `cubic-bezier(<number>, <number>, <number>, <number>)`
6994 CubicBezier,
6995 /// `step-start | step-end | steps(<integer>, [ <step-position> ]?)`
6996 /// `<step-position> = jump-start | jump-end | jump-none | jump-both | start | end`
6997 Steps,
6998 /// linear([<linear-stop>]#)
6999 /// <linear-stop> = <output> && <linear-stop-length>?
7000 /// <linear-stop-length> = <percentage>{1, 2}
7001 LinearFunction,
7002 };
7003
7004 struct StyleKeyword_Body {
7005 StyleTimingKeyword _0;
7006
7007 bool operator==(const StyleKeyword_Body& other) const {
7008 return _0 == other._0;
7009 }
7010 bool operator!=(const StyleKeyword_Body& other) const {
7011 return _0 != other._0;
7012 }
7013 };
7014
7015 struct StyleCubicBezier_Body {
7016 Number x1;
7017 Number y1;
7018 Number x2;
7019 Number y2;
7020
7021 bool operator==(const StyleCubicBezier_Body& other) const {
7022 return x1 == other.x1 &&
7023 y1 == other.y1 &&
7024 x2 == other.x2 &&
7025 y2 == other.y2;
7026 }
7027 bool operator!=(const StyleCubicBezier_Body& other) const {
7028 return x1 != other.x1 ||
7029 y1 != other.y1 ||
7030 x2 != other.x2 ||
7031 y2 != other.y2;
7032 }
7033 };
7034
7035 struct StyleSteps_Body {
7036 Integer _0;
7037 StyleStepPosition _1;
7038
7039 bool operator==(const StyleSteps_Body& other) const {
7040 return _0 == other._0 &&
7041 _1 == other._1;
7042 }
7043 bool operator!=(const StyleSteps_Body& other) const {
7044 return _0 != other._0 ||
7045 _1 != other._1;
7046 }
7047 };
7048
7049 struct StyleLinearFunction_Body {
7050 LinearStops _0;
7051
7052 bool operator==(const StyleLinearFunction_Body& other) const {
7053 return _0 == other._0;
7054 }
7055 bool operator!=(const StyleLinearFunction_Body& other) const {
7056 return _0 != other._0;
7057 }
7058 };
7059
7060 Tag tag;
7061 union {
7062 StyleKeyword_Body keyword;
7063 StyleCubicBezier_Body cubic_bezier;
7064 StyleSteps_Body steps;
7065 StyleLinearFunction_Body linear_function;
7066 };
7067
7068 static StyleTimingFunction Keyword(const StyleTimingKeyword &_0) {
7069 StyleTimingFunction result;
7070 ::new (&result.keyword._0) (StyleTimingKeyword)(_0);
7071 result.tag = Tag::Keyword;
7072 return result;
7073 }
7074
7075 bool IsKeyword() const {
7076 return tag == Tag::Keyword;
7077 }
7078
7079 const StyleTimingKeyword& AsKeyword() const {
7080 MOZ_DIAGNOSTIC_ASSERT(IsKeyword())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsKeyword())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsKeyword()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsKeyword()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7080); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsKeyword()"
")"); do { *((volatile int*)__null) = 7080; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7081 return keyword._0;
7082 }
7083
7084 static StyleTimingFunction CubicBezier(const Number &x1,
7085 const Number &y1,
7086 const Number &x2,
7087 const Number &y2) {
7088 StyleTimingFunction result;
7089 ::new (&result.cubic_bezier.x1) (Number)(x1);
7090 ::new (&result.cubic_bezier.y1) (Number)(y1);
7091 ::new (&result.cubic_bezier.x2) (Number)(x2);
7092 ::new (&result.cubic_bezier.y2) (Number)(y2);
7093 result.tag = Tag::CubicBezier;
7094 return result;
7095 }
7096
7097 bool IsCubicBezier() const {
7098 return tag == Tag::CubicBezier;
7099 }
7100
7101 const StyleCubicBezier_Body& AsCubicBezier() const {
7102 MOZ_DIAGNOSTIC_ASSERT(IsCubicBezier())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCubicBezier())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCubicBezier()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsCubicBezier()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7102); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCubicBezier()"
")"); do { *((volatile int*)__null) = 7102; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7103 return cubic_bezier;
7104 }
7105
7106 static StyleTimingFunction Steps(const Integer &_0,
7107 const StyleStepPosition &_1) {
7108 StyleTimingFunction result;
7109 ::new (&result.steps._0) (Integer)(_0);
7110 ::new (&result.steps._1) (StyleStepPosition)(_1);
7111 result.tag = Tag::Steps;
7112 return result;
7113 }
7114
7115 bool IsSteps() const {
7116 return tag == Tag::Steps;
7117 }
7118
7119 const StyleSteps_Body& AsSteps() const {
7120 MOZ_DIAGNOSTIC_ASSERT(IsSteps())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSteps())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSteps()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSteps()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7120); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSteps()"
")"); do { *((volatile int*)__null) = 7120; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7121 return steps;
7122 }
7123
7124 static StyleTimingFunction LinearFunction(const LinearStops &_0) {
7125 StyleTimingFunction result;
7126 ::new (&result.linear_function._0) (LinearStops)(_0);
7127 result.tag = Tag::LinearFunction;
7128 return result;
7129 }
7130
7131 bool IsLinearFunction() const {
7132 return tag == Tag::LinearFunction;
7133 }
7134
7135 const LinearStops& AsLinearFunction() const {
7136 MOZ_DIAGNOSTIC_ASSERT(IsLinearFunction())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLinearFunction())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLinearFunction()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("IsLinearFunction()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7136); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLinearFunction()"
")"); do { *((volatile int*)__null) = 7136; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7137 return linear_function._0;
7138 }
7139
7140 bool operator==(const StyleTimingFunction& other) const {
7141 if (tag != other.tag) {
7142 return false;
7143 }
7144 switch (tag) {
7145 case Tag::Keyword: return keyword == other.keyword;
7146 case Tag::CubicBezier: return cubic_bezier == other.cubic_bezier;
7147 case Tag::Steps: return steps == other.steps;
7148 case Tag::LinearFunction: return linear_function == other.linear_function;
7149
7150 }
7151 return true;
7152 }
7153
7154 bool operator!=(const StyleTimingFunction& other) const {
7155 return !(*this == other);
7156 }
7157
7158 private:
7159 StyleTimingFunction() {
7160
7161 }
7162 public:
7163
7164
7165 ~StyleTimingFunction() {
7166 switch (tag) {
7167 case Tag::Keyword: keyword.~StyleKeyword_Body(); break;
7168 case Tag::CubicBezier: cubic_bezier.~StyleCubicBezier_Body(); break;
7169 case Tag::Steps: steps.~StyleSteps_Body(); break;
7170 case Tag::LinearFunction: linear_function.~StyleLinearFunction_Body(); break;
7171
7172 }
7173 }
7174
7175 StyleTimingFunction(const StyleTimingFunction& other)
7176 : tag(other.tag) {
7177 switch (tag) {
7178 case Tag::Keyword: ::new (&keyword) (StyleKeyword_Body)(other.keyword); break;
7179 case Tag::CubicBezier: ::new (&cubic_bezier) (StyleCubicBezier_Body)(other.cubic_bezier); break;
7180 case Tag::Steps: ::new (&steps) (StyleSteps_Body)(other.steps); break;
7181 case Tag::LinearFunction: ::new (&linear_function) (StyleLinearFunction_Body)(other.linear_function); break;
7182
7183 }
7184 }
7185 StyleTimingFunction& operator=(const StyleTimingFunction& other) {
7186 if (this != &other) {
7187 this->~StyleTimingFunction();
7188 new (this) StyleTimingFunction(other);
7189 }
7190 return *this;
7191 }
7192 public:
7193 bool IsLinearKeyword() const { return IsKeyword() && AsKeyword() == StyleTimingKeyword::Linear; }
7194 static StyleTimingFunction LinearKeyword() { return Keyword(StyleTimingKeyword::Linear); }
7195
7196 inline double At(double, bool aBeforeFlag) const;
7197 inline void AppendToString(nsACString&) const;
7198
7199 inline static double GetPortion(const Maybe<StyleTimingFunction>&, double, bool aBeforeFlag);
7200};
7201
7202/// A computed timing function.
7203using StyleComputedTimingFunction = StyleTimingFunction<StyleInteger, StyleNumber, StylePiecewiseLinearFunction>;
7204
7205/// The kind of restyle we need to do for a given element.
7206struct StyleRestyleHint {
7207 uint16_t bits;
7208
7209 constexpr explicit operator bool() const {
7210 return !!bits;
7211 }
7212 constexpr StyleRestyleHint operator~() const {
7213 return StyleRestyleHint { static_cast<decltype(bits)>(~bits) };
7214 }
7215 constexpr StyleRestyleHint operator|(const StyleRestyleHint& other) const {
7216 return StyleRestyleHint { static_cast<decltype(bits)>(this->bits | other.bits) };
7217 }
7218 StyleRestyleHint& operator|=(const StyleRestyleHint& other) {
7219 *this = (*this | other);
7220 return *this;
7221 }
7222 constexpr StyleRestyleHint operator&(const StyleRestyleHint& other) const {
7223 return StyleRestyleHint { static_cast<decltype(bits)>(this->bits & other.bits) };
7224 }
7225 StyleRestyleHint& operator&=(const StyleRestyleHint& other) {
7226 *this = (*this & other);
7227 return *this;
7228 }
7229 constexpr StyleRestyleHint operator^(const StyleRestyleHint& other) const {
7230 return StyleRestyleHint { static_cast<decltype(bits)>(this->bits ^ other.bits) };
7231 }
7232 StyleRestyleHint& operator^=(const StyleRestyleHint& other) {
7233 *this = (*this ^ other);
7234 return *this;
7235 }
7236 bool operator==(const StyleRestyleHint& other) const {
7237 return bits == other.bits;
7238 }
7239 bool operator!=(const StyleRestyleHint& other) const {
7240 return bits != other.bits;
7241 }
7242 static inline StyleRestyleHint RestyleSubtree();
7243 static inline StyleRestyleHint RecascadeSubtree();
7244 static inline StyleRestyleHint ForAnimations();
7245 // Returns true if this change hint is guaranteed to at least recascade all
7246 // elements in the subtree of the element it is applied to.
7247 inline bool DefinitelyRecascadesAllSubtree() const;
7248 static const StyleRestyleHint RESTYLE_SELF;
7249 static const StyleRestyleHint RESTYLE_PSEUDOS;
7250 static const StyleRestyleHint RESTYLE_SELF_IF_PSEUDO;
7251 static const StyleRestyleHint RESTYLE_DESCENDANTS;
7252 static const StyleRestyleHint RECASCADE_SELF;
7253 static const StyleRestyleHint RECASCADE_SELF_IF_INHERIT_RESET_STYLE;
7254 static const StyleRestyleHint RECASCADE_DESCENDANTS;
7255 static const StyleRestyleHint RESTYLE_CSS_TRANSITIONS;
7256 static const StyleRestyleHint RESTYLE_CSS_ANIMATIONS;
7257 static const StyleRestyleHint RESTYLE_STYLE_ATTRIBUTE;
7258 static const StyleRestyleHint RESTYLE_SMIL;
7259};
7260/// Do a selector match of the element.
7261constexpr inline const StyleRestyleHint StyleRestyleHint::RESTYLE_SELF = StyleRestyleHint{ /* .bits = */ (uint16_t)(1 << 0) };
7262/// Do a selector match of the element's pseudo-elements. Always to be combined with
7263/// RESTYLE_SELF.
7264constexpr inline const StyleRestyleHint StyleRestyleHint::RESTYLE_PSEUDOS = StyleRestyleHint{ /* .bits = */ (uint16_t)(1 << 1) };
7265/// Do a selector match if the element is a pseudo-element.
7266constexpr inline const StyleRestyleHint StyleRestyleHint::RESTYLE_SELF_IF_PSEUDO = StyleRestyleHint{ /* .bits = */ (uint16_t)(1 << 2) };
7267/// Do a selector match of the element's descendants.
7268constexpr inline const StyleRestyleHint StyleRestyleHint::RESTYLE_DESCENDANTS = StyleRestyleHint{ /* .bits = */ (uint16_t)(1 << 3) };
7269/// Recascade the current element.
7270constexpr inline const StyleRestyleHint StyleRestyleHint::RECASCADE_SELF = StyleRestyleHint{ /* .bits = */ (uint16_t)(1 << 4) };
7271/// Recascade the current element if it inherits any reset style.
7272constexpr inline const StyleRestyleHint StyleRestyleHint::RECASCADE_SELF_IF_INHERIT_RESET_STYLE = StyleRestyleHint{ /* .bits = */ (uint16_t)(1 << 5) };
7273/// Recascade all descendant elements.
7274constexpr inline const StyleRestyleHint StyleRestyleHint::RECASCADE_DESCENDANTS = StyleRestyleHint{ /* .bits = */ (uint16_t)(1 << 6) };
7275/// Replace the style data coming from CSS transitions without updating
7276/// any other style data. This hint is only processed in animation-only
7277/// traversal which is prior to normal traversal.
7278constexpr inline const StyleRestyleHint StyleRestyleHint::RESTYLE_CSS_TRANSITIONS = StyleRestyleHint{ /* .bits = */ (uint16_t)(1 << 7) };
7279/// Replace the style data coming from CSS animations without updating
7280/// any other style data. This hint is only processed in animation-only
7281/// traversal which is prior to normal traversal.
7282constexpr inline const StyleRestyleHint StyleRestyleHint::RESTYLE_CSS_ANIMATIONS = StyleRestyleHint{ /* .bits = */ (uint16_t)(1 << 8) };
7283/// Don't re-run selector-matching on the element, only the style
7284/// attribute has changed, and this change didn't have any other
7285/// dependencies.
7286constexpr inline const StyleRestyleHint StyleRestyleHint::RESTYLE_STYLE_ATTRIBUTE = StyleRestyleHint{ /* .bits = */ (uint16_t)(1 << 9) };
7287/// Replace the style data coming from SMIL animations without updating
7288/// any other style data. This hint is only processed in animation-only
7289/// traversal which is prior to normal traversal.
7290constexpr inline const StyleRestyleHint StyleRestyleHint::RESTYLE_SMIL = StyleRestyleHint{ /* .bits = */ (uint16_t)(1 << 10) };
7291
7292/// The 3 components that make up a color. (Does not include the alpha component)
7293struct StyleColorComponents {
7294 float _0;
7295 float _1;
7296 float _2;
7297
7298 bool operator==(const StyleColorComponents& other) const {
7299 return _0 == other._0 &&
7300 _1 == other._1 &&
7301 _2 == other._2;
7302 }
7303 bool operator!=(const StyleColorComponents& other) const {
7304 return _0 != other._0 ||
7305 _1 != other._1 ||
7306 _2 != other._2;
7307 }
7308};
7309
7310/// Flags used when serializing colors.
7311struct StyleColorFlags {
7312 uint8_t _0;
7313
7314 constexpr explicit operator bool() const {
7315 return !!_0;
7316 }
7317 constexpr StyleColorFlags operator~() const {
7318 return StyleColorFlags { static_cast<decltype(_0)>(~_0) };
7319 }
7320 constexpr StyleColorFlags operator|(const StyleColorFlags& other) const {
7321 return StyleColorFlags { static_cast<decltype(_0)>(this->_0 | other._0) };
7322 }
7323 StyleColorFlags& operator|=(const StyleColorFlags& other) {
7324 *this = (*this | other);
7325 return *this;
7326 }
7327 constexpr StyleColorFlags operator&(const StyleColorFlags& other) const {
7328 return StyleColorFlags { static_cast<decltype(_0)>(this->_0 & other._0) };
7329 }
7330 StyleColorFlags& operator&=(const StyleColorFlags& other) {
7331 *this = (*this & other);
7332 return *this;
7333 }
7334 constexpr StyleColorFlags operator^(const StyleColorFlags& other) const {
7335 return StyleColorFlags { static_cast<decltype(_0)>(this->_0 ^ other._0) };
7336 }
7337 StyleColorFlags& operator^=(const StyleColorFlags& other) {
7338 *this = (*this ^ other);
7339 return *this;
7340 }
7341 bool operator==(const StyleColorFlags& other) const {
7342 return _0 == other._0;
7343 }
7344 bool operator!=(const StyleColorFlags& other) const {
7345 return _0 != other._0;
7346 }
7347 static const StyleColorFlags C0_IS_NONE;
7348 static const StyleColorFlags C1_IS_NONE;
7349 static const StyleColorFlags C2_IS_NONE;
7350 static const StyleColorFlags ALPHA_IS_NONE;
7351 static const StyleColorFlags IS_LEGACY_SRGB;
7352};
7353/// Whether the 1st color component is `none`.
7354constexpr inline const StyleColorFlags StyleColorFlags::C0_IS_NONE = StyleColorFlags{ /* ._0 = */ (uint8_t)(1 << 0) };
7355/// Whether the 2nd color component is `none`.
7356constexpr inline const StyleColorFlags StyleColorFlags::C1_IS_NONE = StyleColorFlags{ /* ._0 = */ (uint8_t)(1 << 1) };
7357/// Whether the 3rd color component is `none`.
7358constexpr inline const StyleColorFlags StyleColorFlags::C2_IS_NONE = StyleColorFlags{ /* ._0 = */ (uint8_t)(1 << 2) };
7359/// Whether the alpha component is `none`.
7360constexpr inline const StyleColorFlags StyleColorFlags::ALPHA_IS_NONE = StyleColorFlags{ /* ._0 = */ (uint8_t)(1 << 3) };
7361/// Marks that this color is in the legacy color format. This flag is
7362/// only valid for the `Srgb` color space.
7363constexpr inline const StyleColorFlags StyleColorFlags::IS_LEGACY_SRGB = StyleColorFlags{ /* ._0 = */ (uint8_t)(1 << 4) };
7364
7365/// An absolutely specified color, using either rgb(), rgba(), lab(), lch(),
7366/// oklab(), oklch() or color().
7367struct StyleAbsoluteColor {
7368 /// The 3 components that make up colors in any color space.
7369 StyleColorComponents components;
7370 /// The alpha component of the color.
7371 float alpha;
7372 /// The current color space that the components represent.
7373 StyleColorSpace color_space;
7374 /// Extra flags used durring serialization of this color.
7375 StyleColorFlags flags;
7376
7377 bool operator==(const StyleAbsoluteColor& other) const {
7378 return components == other.components &&
7379 alpha == other.alpha &&
7380 color_space == other.color_space &&
7381 flags == other.flags;
7382 }
7383 bool operator!=(const StyleAbsoluteColor& other) const {
7384 return components != other.components ||
7385 alpha != other.alpha ||
7386 color_space != other.color_space ||
7387 flags != other.flags;
7388 }
7389 /**
7390 * Create a new AbsoluteColor in the sRGB color space in legacy color syntax.
7391 */
7392 static inline StyleAbsoluteColor SrgbLegacy(float red, float green, float blue, float alpha);
7393
7394 static inline StyleAbsoluteColor FromColor(nscolor);
7395
7396 /**
7397 * Convert this color into the given color space.
7398 */
7399 StyleAbsoluteColor ToColorSpace(StyleColorSpace aColorSpace) const;
7400
7401 /**
7402 * Convert this color to an nscolor. The color will be converted to sRGB first
7403 * if required.
7404 */
7405 nscolor ToColor() const;
7406 static const StyleAbsoluteColor TRANSPARENT_BLACK;
7407 static const StyleAbsoluteColor BLACK;
7408 static const StyleAbsoluteColor WHITE;
7409};
7410/// A fully transparent color in the legacy syntax.
7411constexpr inline const StyleAbsoluteColor StyleAbsoluteColor::TRANSPARENT_BLACK = StyleAbsoluteColor{ /* .components = */ StyleColorComponents{ /* ._0 = */ 0.0, /* ._1 = */ 0.0, /* ._2 = */ 0.0 }, /* .alpha = */ 0.0, /* .color_space = */ StyleColorSpace::Srgb, /* .flags = */ StyleColorFlags::IS_LEGACY_SRGB };
7412/// An opaque black color in the legacy syntax.
7413constexpr inline const StyleAbsoluteColor StyleAbsoluteColor::BLACK = StyleAbsoluteColor{ /* .components = */ StyleColorComponents{ /* ._0 = */ 0.0, /* ._1 = */ 0.0, /* ._2 = */ 0.0 }, /* .alpha = */ 1.0, /* .color_space = */ StyleColorSpace::Srgb, /* .flags = */ StyleColorFlags::IS_LEGACY_SRGB };
7414/// An opaque white color in the legacy syntax.
7415constexpr inline const StyleAbsoluteColor StyleAbsoluteColor::WHITE = StyleAbsoluteColor{ /* .components = */ StyleColorComponents{ /* ._0 = */ 1.0, /* ._1 = */ 1.0, /* ._2 = */ 1.0 }, /* .alpha = */ 1.0, /* .color_space = */ StyleColorSpace::Srgb, /* .flags = */ StyleColorFlags::IS_LEGACY_SRGB };
7416
7417/// An optional value, much like `Option<T>`, but with a defined struct layout
7418/// to be able to use it from C++ as well.
7419///
7420/// Note that this is relatively inefficient, struct-layout-wise, as you have
7421/// one byte for the tag, but padding to the alignment of T. If you have
7422/// multiple optional values and care about struct compactness, you might be
7423/// better off "coalescing" the combinations into a parent enum. But that
7424/// shouldn't matter for most use cases.
7425template<typename T>
7426struct StyleOptional {
7427 enum class Tag : uint8_t {
7428 None,
7429 Some,
7430 };
7431
7432 struct StyleSome_Body {
7433 T _0;
7434
7435 bool operator==(const StyleSome_Body& other) const {
7436 return _0 == other._0;
7437 }
7438 bool operator!=(const StyleSome_Body& other) const {
7439 return _0 != other._0;
7440 }
7441 };
7442
7443 Tag tag;
7444 union {
7445 StyleSome_Body some;
7446 };
7447
7448 static StyleOptional None() {
7449 StyleOptional result;
7450 result.tag = Tag::None;
7451 return result;
7452 }
7453
7454 bool IsNone() const {
7455 return tag == Tag::None;
7456 }
7457
7458 static StyleOptional Some(const T &_0) {
7459 StyleOptional result;
7460 ::new (&result.some._0) (T)(_0);
7461 result.tag = Tag::Some;
7462 return result;
7463 }
7464
7465 bool IsSome() const {
7466 return tag == Tag::Some;
7467 }
7468
7469 const T& AsSome() const {
7470 MOZ_DIAGNOSTIC_ASSERT(IsSome())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSome())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSome()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSome()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7470); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSome()"
")"); do { *((volatile int*)__null) = 7470; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7471 return some._0;
7472 }
7473
7474 bool operator==(const StyleOptional& other) const {
7475 if (tag != other.tag) {
7476 return false;
7477 }
7478 switch (tag) {
7479 case Tag::Some: return some == other.some;
7480 default: break;
7481 }
7482 return true;
7483 }
7484
7485 bool operator!=(const StyleOptional& other) const {
7486 return !(*this == other);
7487 }
7488
7489 private:
7490 StyleOptional() {
7491
7492 }
7493 public:
7494
7495
7496 ~StyleOptional() {
7497 switch (tag) {
7498 case Tag::Some: some.~StyleSome_Body(); break;
7499 default: break;
7500 }
7501 }
7502
7503 StyleOptional(const StyleOptional& other)
7504 : tag(other.tag) {
7505 switch (tag) {
7506 case Tag::Some: ::new (&some) (StyleSome_Body)(other.some); break;
7507 default: break;
7508 }
7509 }
7510 StyleOptional& operator=(const StyleOptional& other) {
7511 if (this != &other) {
7512 this->~StyleOptional();
7513 new (this) StyleOptional(other);
7514 }
7515 return *this;
7516 }
7517};
7518
7519/// Either a percentage or a number.
7520union StyleNumberOrPercentageComponent {
7521 enum class Tag : uint8_t {
7522 /// `<number>`.
7523 Number,
7524 /// `<percentage>`
7525 /// The value as a float, divided by 100 so that the nominal range is 0.0 to 1.0.
7526 Percentage,
7527 };
7528
7529 struct Number_Body {
7530 Tag tag;
7531 float _0;
7532
7533 bool operator==(const Number_Body& other) const {
7534 return _0 == other._0;
7535 }
7536 bool operator!=(const Number_Body& other) const {
7537 return _0 != other._0;
7538 }
7539 };
7540
7541 struct Percentage_Body {
7542 Tag tag;
7543 float _0;
7544
7545 bool operator==(const Percentage_Body& other) const {
7546 return _0 == other._0;
7547 }
7548 bool operator!=(const Percentage_Body& other) const {
7549 return _0 != other._0;
7550 }
7551 };
7552
7553 struct {
7554 Tag tag;
7555 };
7556 Number_Body number;
7557 Percentage_Body percentage;
7558
7559 static StyleNumberOrPercentageComponent Number(const float &_0) {
7560 StyleNumberOrPercentageComponent result;
7561 ::new (&result.number._0) (float)(_0);
7562 result.tag = Tag::Number;
7563 return result;
7564 }
7565
7566 bool IsNumber() const {
7567 return tag == Tag::Number;
7568 }
7569
7570 const float& AsNumber() const {
7571 MOZ_DIAGNOSTIC_ASSERT(IsNumber())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsNumber())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsNumber()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsNumber()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7571); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsNumber()"
")"); do { *((volatile int*)__null) = 7571; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7572 return number._0;
7573 }
7574
7575 static StyleNumberOrPercentageComponent Percentage(const float &_0) {
7576 StyleNumberOrPercentageComponent result;
7577 ::new (&result.percentage._0) (float)(_0);
7578 result.tag = Tag::Percentage;
7579 return result;
7580 }
7581
7582 bool IsPercentage() const {
7583 return tag == Tag::Percentage;
7584 }
7585
7586 const float& AsPercentage() const {
7587 MOZ_DIAGNOSTIC_ASSERT(IsPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPercentage()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7587); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPercentage()"
")"); do { *((volatile int*)__null) = 7587; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7588 return percentage._0;
7589 }
7590
7591 bool operator==(const StyleNumberOrPercentageComponent& other) const {
7592 if (tag != other.tag) {
7593 return false;
7594 }
7595 switch (tag) {
7596 case Tag::Number: return number == other.number;
7597 case Tag::Percentage: return percentage == other.percentage;
7598
7599 }
7600 return true;
7601 }
7602
7603 bool operator!=(const StyleNumberOrPercentageComponent& other) const {
7604 return !(*this == other);
7605 }
7606
7607 private:
7608 StyleNumberOrPercentageComponent() {
7609
7610 }
7611 public:
7612
7613
7614 ~StyleNumberOrPercentageComponent() {
7615 switch (tag) {
7616 case Tag::Number: number.~Number_Body(); break;
7617 case Tag::Percentage: percentage.~Percentage_Body(); break;
7618
7619 }
7620 }
7621
7622 StyleNumberOrPercentageComponent(const StyleNumberOrPercentageComponent& other)
7623 : tag(other.tag) {
7624 switch (tag) {
7625 case Tag::Number: ::new (&number) (Number_Body)(other.number); break;
7626 case Tag::Percentage: ::new (&percentage) (Percentage_Body)(other.percentage); break;
7627
7628 }
7629 }
7630 StyleNumberOrPercentageComponent& operator=(const StyleNumberOrPercentageComponent& other) {
7631 if (this != &other) {
7632 this->~StyleNumberOrPercentageComponent();
7633 new (this) StyleNumberOrPercentageComponent(other);
7634 }
7635 return *this;
7636 }
7637};
7638
7639/// Represents an absolute length with its unit
7640union StyleAbsoluteLength {
7641 enum class Tag : uint8_t {
7642 /// An absolute length in pixels (px)
7643 Px,
7644 /// An absolute length in inches (in)
7645 In,
7646 /// An absolute length in centimeters (cm)
7647 Cm,
7648 /// An absolute length in millimeters (mm)
7649 Mm,
7650 /// An absolute length in quarter-millimeters (q)
7651 Q,
7652 /// An absolute length in points (pt)
7653 Pt,
7654 /// An absolute length in pica (pc)
7655 Pc,
7656 };
7657
7658 struct Px_Body {
7659 Tag tag;
7660 StyleCSSFloat _0;
7661
7662 bool operator==(const Px_Body& other) const {
7663 return _0 == other._0;
7664 }
7665 bool operator!=(const Px_Body& other) const {
7666 return _0 != other._0;
7667 }
7668 };
7669
7670 struct In_Body {
7671 Tag tag;
7672 StyleCSSFloat _0;
7673
7674 bool operator==(const In_Body& other) const {
7675 return _0 == other._0;
7676 }
7677 bool operator!=(const In_Body& other) const {
7678 return _0 != other._0;
7679 }
7680 };
7681
7682 struct Cm_Body {
7683 Tag tag;
7684 StyleCSSFloat _0;
7685
7686 bool operator==(const Cm_Body& other) const {
7687 return _0 == other._0;
7688 }
7689 bool operator!=(const Cm_Body& other) const {
7690 return _0 != other._0;
7691 }
7692 };
7693
7694 struct Mm_Body {
7695 Tag tag;
7696 StyleCSSFloat _0;
7697
7698 bool operator==(const Mm_Body& other) const {
7699 return _0 == other._0;
7700 }
7701 bool operator!=(const Mm_Body& other) const {
7702 return _0 != other._0;
7703 }
7704 };
7705
7706 struct Q_Body {
7707 Tag tag;
7708 StyleCSSFloat _0;
7709
7710 bool operator==(const Q_Body& other) const {
7711 return _0 == other._0;
7712 }
7713 bool operator!=(const Q_Body& other) const {
7714 return _0 != other._0;
7715 }
7716 };
7717
7718 struct Pt_Body {
7719 Tag tag;
7720 StyleCSSFloat _0;
7721
7722 bool operator==(const Pt_Body& other) const {
7723 return _0 == other._0;
7724 }
7725 bool operator!=(const Pt_Body& other) const {
7726 return _0 != other._0;
7727 }
7728 };
7729
7730 struct Pc_Body {
7731 Tag tag;
7732 StyleCSSFloat _0;
7733
7734 bool operator==(const Pc_Body& other) const {
7735 return _0 == other._0;
7736 }
7737 bool operator!=(const Pc_Body& other) const {
7738 return _0 != other._0;
7739 }
7740 };
7741
7742 struct {
7743 Tag tag;
7744 };
7745 Px_Body px;
7746 In_Body in;
7747 Cm_Body cm;
7748 Mm_Body mm;
7749 Q_Body q;
7750 Pt_Body pt;
7751 Pc_Body pc;
7752
7753 static StyleAbsoluteLength Px(const StyleCSSFloat &_0) {
7754 StyleAbsoluteLength result;
7755 ::new (&result.px._0) (StyleCSSFloat)(_0);
7756 result.tag = Tag::Px;
7757 return result;
7758 }
7759
7760 bool IsPx() const {
7761 return tag == Tag::Px;
7762 }
7763
7764 const StyleCSSFloat& AsPx() const {
7765 MOZ_DIAGNOSTIC_ASSERT(IsPx())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPx())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsPx()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsPx()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7765); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPx()"
")"); do { *((volatile int*)__null) = 7765; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7766 return px._0;
7767 }
7768
7769 static StyleAbsoluteLength In(const StyleCSSFloat &_0) {
7770 StyleAbsoluteLength result;
7771 ::new (&result.in._0) (StyleCSSFloat)(_0);
7772 result.tag = Tag::In;
7773 return result;
7774 }
7775
7776 bool IsIn() const {
7777 return tag == Tag::In;
7778 }
7779
7780 const StyleCSSFloat& AsIn() const {
7781 MOZ_DIAGNOSTIC_ASSERT(IsIn())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsIn())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsIn()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsIn()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7781); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsIn()"
")"); do { *((volatile int*)__null) = 7781; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7782 return in._0;
7783 }
7784
7785 static StyleAbsoluteLength Cm(const StyleCSSFloat &_0) {
7786 StyleAbsoluteLength result;
7787 ::new (&result.cm._0) (StyleCSSFloat)(_0);
7788 result.tag = Tag::Cm;
7789 return result;
7790 }
7791
7792 bool IsCm() const {
7793 return tag == Tag::Cm;
7794 }
7795
7796 const StyleCSSFloat& AsCm() const {
7797 MOZ_DIAGNOSTIC_ASSERT(IsCm())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCm())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsCm()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsCm()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7797); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCm()"
")"); do { *((volatile int*)__null) = 7797; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7798 return cm._0;
7799 }
7800
7801 static StyleAbsoluteLength Mm(const StyleCSSFloat &_0) {
7802 StyleAbsoluteLength result;
7803 ::new (&result.mm._0) (StyleCSSFloat)(_0);
7804 result.tag = Tag::Mm;
7805 return result;
7806 }
7807
7808 bool IsMm() const {
7809 return tag == Tag::Mm;
7810 }
7811
7812 const StyleCSSFloat& AsMm() const {
7813 MOZ_DIAGNOSTIC_ASSERT(IsMm())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsMm())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsMm()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsMm()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7813); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsMm()"
")"); do { *((volatile int*)__null) = 7813; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7814 return mm._0;
7815 }
7816
7817 static StyleAbsoluteLength Q(const StyleCSSFloat &_0) {
7818 StyleAbsoluteLength result;
7819 ::new (&result.q._0) (StyleCSSFloat)(_0);
7820 result.tag = Tag::Q;
7821 return result;
7822 }
7823
7824 bool IsQ() const {
7825 return tag == Tag::Q;
7826 }
7827
7828 const StyleCSSFloat& AsQ() const {
7829 MOZ_DIAGNOSTIC_ASSERT(IsQ())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsQ())>::isValid, "invalid assertion condition");
if ((__builtin_expect(!!(!(!!(IsQ()))), 0))) { do { } while (
false); MOZ_ReportAssertionFailure("IsQ()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7829); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsQ()"
")"); do { *((volatile int*)__null) = 7829; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7830 return q._0;
7831 }
7832
7833 static StyleAbsoluteLength Pt(const StyleCSSFloat &_0) {
7834 StyleAbsoluteLength result;
7835 ::new (&result.pt._0) (StyleCSSFloat)(_0);
7836 result.tag = Tag::Pt;
7837 return result;
7838 }
7839
7840 bool IsPt() const {
7841 return tag == Tag::Pt;
7842 }
7843
7844 const StyleCSSFloat& AsPt() const {
7845 MOZ_DIAGNOSTIC_ASSERT(IsPt())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPt())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsPt()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsPt()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7845); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPt()"
")"); do { *((volatile int*)__null) = 7845; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7846 return pt._0;
7847 }
7848
7849 static StyleAbsoluteLength Pc(const StyleCSSFloat &_0) {
7850 StyleAbsoluteLength result;
7851 ::new (&result.pc._0) (StyleCSSFloat)(_0);
7852 result.tag = Tag::Pc;
7853 return result;
7854 }
7855
7856 bool IsPc() const {
7857 return tag == Tag::Pc;
7858 }
7859
7860 const StyleCSSFloat& AsPc() const {
7861 MOZ_DIAGNOSTIC_ASSERT(IsPc())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPc())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsPc()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsPc()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 7861); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPc()"
")"); do { *((volatile int*)__null) = 7861; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
7862 return pc._0;
7863 }
7864
7865 bool operator==(const StyleAbsoluteLength& other) const {
7866 if (tag != other.tag) {
7867 return false;
7868 }
7869 switch (tag) {
7870 case Tag::Px: return px == other.px;
7871 case Tag::In: return in == other.in;
7872 case Tag::Cm: return cm == other.cm;
7873 case Tag::Mm: return mm == other.mm;
7874 case Tag::Q: return q == other.q;
7875 case Tag::Pt: return pt == other.pt;
7876 case Tag::Pc: return pc == other.pc;
7877
7878 }
7879 return true;
7880 }
7881
7882 bool operator!=(const StyleAbsoluteLength& other) const {
7883 return !(*this == other);
7884 }
7885
7886 private:
7887 StyleAbsoluteLength() {
7888
7889 }
7890 public:
7891
7892
7893 ~StyleAbsoluteLength() {
7894 switch (tag) {
7895 case Tag::Px: px.~Px_Body(); break;
7896 case Tag::In: in.~In_Body(); break;
7897 case Tag::Cm: cm.~Cm_Body(); break;
7898 case Tag::Mm: mm.~Mm_Body(); break;
7899 case Tag::Q: q.~Q_Body(); break;
7900 case Tag::Pt: pt.~Pt_Body(); break;
7901 case Tag::Pc: pc.~Pc_Body(); break;
7902
7903 }
7904 }
7905
7906 StyleAbsoluteLength(const StyleAbsoluteLength& other)
7907 : tag(other.tag) {
7908 switch (tag) {
7909 case Tag::Px: ::new (&px) (Px_Body)(other.px); break;
7910 case Tag::In: ::new (&in) (In_Body)(other.in); break;
7911 case Tag::Cm: ::new (&cm) (Cm_Body)(other.cm); break;
7912 case Tag::Mm: ::new (&mm) (Mm_Body)(other.mm); break;
7913 case Tag::Q: ::new (&q) (Q_Body)(other.q); break;
7914 case Tag::Pt: ::new (&pt) (Pt_Body)(other.pt); break;
7915 case Tag::Pc: ::new (&pc) (Pc_Body)(other.pc); break;
7916
7917 }
7918 }
7919 StyleAbsoluteLength& operator=(const StyleAbsoluteLength& other) {
7920 if (this != &other) {
7921 this->~StyleAbsoluteLength();
7922 new (this) StyleAbsoluteLength(other);
7923 }
7924 return *this;
7925 }
7926};
7927
7928/// A font relative length. Note that if any new value is
7929/// added here, `custom_properties::NonCustomReferences::from_unit`
7930/// must also be updated. Consult the comment in that function as to why.
7931union StyleFontRelativeLength {
7932 enum class Tag : uint8_t {
7933 /// A "em" value: https://drafts.csswg.org/css-values/#em
7934 Em,
7935 /// A "ex" value: https://drafts.csswg.org/css-values/#ex
7936 Ex,
7937 /// A "ch" value: https://drafts.csswg.org/css-values/#ch
7938 Ch,
7939 /// A "cap" value: https://drafts.csswg.org/css-values/#cap
7940 Cap,
7941 /// An "ic" value: https://drafts.csswg.org/css-values/#ic
7942 Ic,
7943 /// A "rem" value: https://drafts.csswg.org/css-values/#rem
7944 Rem,
7945 /// A "lh" value: https://drafts.csswg.org/css-values/#lh
7946 Lh,
7947 /// A "rlh" value: https://drafts.csswg.org/css-values/#lh
7948 Rlh,
7949 };
7950
7951 struct Em_Body {
7952 Tag tag;
7953 StyleCSSFloat _0;
7954
7955 bool operator==(const Em_Body& other) const {
7956 return _0 == other._0;
7957 }
7958 bool operator!=(const Em_Body& other) const {
7959 return _0 != other._0;
7960 }
7961 };
7962
7963 struct Ex_Body {
7964 Tag tag;
7965 StyleCSSFloat _0;
7966
7967 bool operator==(const Ex_Body& other) const {
7968 return _0 == other._0;
7969 }
7970 bool operator!=(const Ex_Body& other) const {
7971 return _0 != other._0;
7972 }
7973 };
7974
7975 struct Ch_Body {
7976 Tag tag;
7977 StyleCSSFloat _0;
7978
7979 bool operator==(const Ch_Body& other) const {
7980 return _0 == other._0;
7981 }
7982 bool operator!=(const Ch_Body& other) const {
7983 return _0 != other._0;
7984 }
7985 };
7986
7987 struct Cap_Body {
7988 Tag tag;
7989 StyleCSSFloat _0;
7990
7991 bool operator==(const Cap_Body& other) const {
7992 return _0 == other._0;
7993 }
7994 bool operator!=(const Cap_Body& other) const {
7995 return _0 != other._0;
7996 }
7997 };
7998
7999 struct Ic_Body {
8000 Tag tag;
8001 StyleCSSFloat _0;
8002
8003 bool operator==(const Ic_Body& other) const {
8004 return _0 == other._0;
8005 }
8006 bool operator!=(const Ic_Body& other) const {
8007 return _0 != other._0;
8008 }
8009 };
8010
8011 struct Rem_Body {
8012 Tag tag;
8013 StyleCSSFloat _0;
8014
8015 bool operator==(const Rem_Body& other) const {
8016 return _0 == other._0;
8017 }
8018 bool operator!=(const Rem_Body& other) const {
8019 return _0 != other._0;
8020 }
8021 };
8022
8023 struct Lh_Body {
8024 Tag tag;
8025 StyleCSSFloat _0;
8026
8027 bool operator==(const Lh_Body& other) const {
8028 return _0 == other._0;
8029 }
8030 bool operator!=(const Lh_Body& other) const {
8031 return _0 != other._0;
8032 }
8033 };
8034
8035 struct Rlh_Body {
8036 Tag tag;
8037 StyleCSSFloat _0;
8038
8039 bool operator==(const Rlh_Body& other) const {
8040 return _0 == other._0;
8041 }
8042 bool operator!=(const Rlh_Body& other) const {
8043 return _0 != other._0;
8044 }
8045 };
8046
8047 struct {
8048 Tag tag;
8049 };
8050 Em_Body em;
8051 Ex_Body ex;
8052 Ch_Body ch;
8053 Cap_Body cap;
8054 Ic_Body ic;
8055 Rem_Body rem;
8056 Lh_Body lh;
8057 Rlh_Body rlh;
8058
8059 static StyleFontRelativeLength Em(const StyleCSSFloat &_0) {
8060 StyleFontRelativeLength result;
8061 ::new (&result.em._0) (StyleCSSFloat)(_0);
8062 result.tag = Tag::Em;
8063 return result;
8064 }
8065
8066 bool IsEm() const {
8067 return tag == Tag::Em;
8068 }
8069
8070 const StyleCSSFloat& AsEm() const {
8071 MOZ_DIAGNOSTIC_ASSERT(IsEm())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsEm())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsEm()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsEm()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8071); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsEm()"
")"); do { *((volatile int*)__null) = 8071; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8072 return em._0;
8073 }
8074
8075 static StyleFontRelativeLength Ex(const StyleCSSFloat &_0) {
8076 StyleFontRelativeLength result;
8077 ::new (&result.ex._0) (StyleCSSFloat)(_0);
8078 result.tag = Tag::Ex;
8079 return result;
8080 }
8081
8082 bool IsEx() const {
8083 return tag == Tag::Ex;
8084 }
8085
8086 const StyleCSSFloat& AsEx() const {
8087 MOZ_DIAGNOSTIC_ASSERT(IsEx())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsEx())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsEx()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsEx()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8087); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsEx()"
")"); do { *((volatile int*)__null) = 8087; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8088 return ex._0;
8089 }
8090
8091 static StyleFontRelativeLength Ch(const StyleCSSFloat &_0) {
8092 StyleFontRelativeLength result;
8093 ::new (&result.ch._0) (StyleCSSFloat)(_0);
8094 result.tag = Tag::Ch;
8095 return result;
8096 }
8097
8098 bool IsCh() const {
8099 return tag == Tag::Ch;
8100 }
8101
8102 const StyleCSSFloat& AsCh() const {
8103 MOZ_DIAGNOSTIC_ASSERT(IsCh())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCh())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsCh()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsCh()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8103); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCh()"
")"); do { *((volatile int*)__null) = 8103; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8104 return ch._0;
8105 }
8106
8107 static StyleFontRelativeLength Cap(const StyleCSSFloat &_0) {
8108 StyleFontRelativeLength result;
8109 ::new (&result.cap._0) (StyleCSSFloat)(_0);
8110 result.tag = Tag::Cap;
8111 return result;
8112 }
8113
8114 bool IsCap() const {
8115 return tag == Tag::Cap;
8116 }
8117
8118 const StyleCSSFloat& AsCap() const {
8119 MOZ_DIAGNOSTIC_ASSERT(IsCap())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCap())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCap()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsCap()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8119); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCap()"
")"); do { *((volatile int*)__null) = 8119; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8120 return cap._0;
8121 }
8122
8123 static StyleFontRelativeLength Ic(const StyleCSSFloat &_0) {
8124 StyleFontRelativeLength result;
8125 ::new (&result.ic._0) (StyleCSSFloat)(_0);
8126 result.tag = Tag::Ic;
8127 return result;
8128 }
8129
8130 bool IsIc() const {
8131 return tag == Tag::Ic;
8132 }
8133
8134 const StyleCSSFloat& AsIc() const {
8135 MOZ_DIAGNOSTIC_ASSERT(IsIc())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsIc())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsIc()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsIc()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8135); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsIc()"
")"); do { *((volatile int*)__null) = 8135; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8136 return ic._0;
8137 }
8138
8139 static StyleFontRelativeLength Rem(const StyleCSSFloat &_0) {
8140 StyleFontRelativeLength result;
8141 ::new (&result.rem._0) (StyleCSSFloat)(_0);
8142 result.tag = Tag::Rem;
8143 return result;
8144 }
8145
8146 bool IsRem() const {
8147 return tag == Tag::Rem;
8148 }
8149
8150 const StyleCSSFloat& AsRem() const {
8151 MOZ_DIAGNOSTIC_ASSERT(IsRem())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRem())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRem()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsRem()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8151); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRem()"
")"); do { *((volatile int*)__null) = 8151; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8152 return rem._0;
8153 }
8154
8155 static StyleFontRelativeLength Lh(const StyleCSSFloat &_0) {
8156 StyleFontRelativeLength result;
8157 ::new (&result.lh._0) (StyleCSSFloat)(_0);
8158 result.tag = Tag::Lh;
8159 return result;
8160 }
8161
8162 bool IsLh() const {
8163 return tag == Tag::Lh;
8164 }
8165
8166 const StyleCSSFloat& AsLh() const {
8167 MOZ_DIAGNOSTIC_ASSERT(IsLh())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLh())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsLh()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLh()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8167); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLh()"
")"); do { *((volatile int*)__null) = 8167; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8168 return lh._0;
8169 }
8170
8171 static StyleFontRelativeLength Rlh(const StyleCSSFloat &_0) {
8172 StyleFontRelativeLength result;
8173 ::new (&result.rlh._0) (StyleCSSFloat)(_0);
8174 result.tag = Tag::Rlh;
8175 return result;
8176 }
8177
8178 bool IsRlh() const {
8179 return tag == Tag::Rlh;
8180 }
8181
8182 const StyleCSSFloat& AsRlh() const {
8183 MOZ_DIAGNOSTIC_ASSERT(IsRlh())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRlh())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRlh()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsRlh()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8183); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRlh()"
")"); do { *((volatile int*)__null) = 8183; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8184 return rlh._0;
8185 }
8186
8187 bool operator==(const StyleFontRelativeLength& other) const {
8188 if (tag != other.tag) {
8189 return false;
8190 }
8191 switch (tag) {
8192 case Tag::Em: return em == other.em;
8193 case Tag::Ex: return ex == other.ex;
8194 case Tag::Ch: return ch == other.ch;
8195 case Tag::Cap: return cap == other.cap;
8196 case Tag::Ic: return ic == other.ic;
8197 case Tag::Rem: return rem == other.rem;
8198 case Tag::Lh: return lh == other.lh;
8199 case Tag::Rlh: return rlh == other.rlh;
8200
8201 }
8202 return true;
8203 }
8204
8205 bool operator!=(const StyleFontRelativeLength& other) const {
8206 return !(*this == other);
8207 }
8208
8209 private:
8210 StyleFontRelativeLength() {
8211
8212 }
8213 public:
8214
8215
8216 ~StyleFontRelativeLength() {
8217 switch (tag) {
8218 case Tag::Em: em.~Em_Body(); break;
8219 case Tag::Ex: ex.~Ex_Body(); break;
8220 case Tag::Ch: ch.~Ch_Body(); break;
8221 case Tag::Cap: cap.~Cap_Body(); break;
8222 case Tag::Ic: ic.~Ic_Body(); break;
8223 case Tag::Rem: rem.~Rem_Body(); break;
8224 case Tag::Lh: lh.~Lh_Body(); break;
8225 case Tag::Rlh: rlh.~Rlh_Body(); break;
8226
8227 }
8228 }
8229
8230 StyleFontRelativeLength(const StyleFontRelativeLength& other)
8231 : tag(other.tag) {
8232 switch (tag) {
8233 case Tag::Em: ::new (&em) (Em_Body)(other.em); break;
8234 case Tag::Ex: ::new (&ex) (Ex_Body)(other.ex); break;
8235 case Tag::Ch: ::new (&ch) (Ch_Body)(other.ch); break;
8236 case Tag::Cap: ::new (&cap) (Cap_Body)(other.cap); break;
8237 case Tag::Ic: ::new (&ic) (Ic_Body)(other.ic); break;
8238 case Tag::Rem: ::new (&rem) (Rem_Body)(other.rem); break;
8239 case Tag::Lh: ::new (&lh) (Lh_Body)(other.lh); break;
8240 case Tag::Rlh: ::new (&rlh) (Rlh_Body)(other.rlh); break;
8241
8242 }
8243 }
8244 StyleFontRelativeLength& operator=(const StyleFontRelativeLength& other) {
8245 if (this != &other) {
8246 this->~StyleFontRelativeLength();
8247 new (this) StyleFontRelativeLength(other);
8248 }
8249 return *this;
8250 }
8251};
8252
8253/// A viewport-relative length.
8254///
8255/// <https://drafts.csswg.org/css-values/#viewport-relative-lengths>
8256union StyleViewportPercentageLength {
8257 enum class Tag : uint8_t {
8258 /// <https://drafts.csswg.org/css-values/#valdef-length-vw>
8259 Vw,
8260 /// <https://drafts.csswg.org/css-values/#valdef-length-svw>
8261 Svw,
8262 /// <https://drafts.csswg.org/css-values/#valdef-length-lvw>
8263 Lvw,
8264 /// <https://drafts.csswg.org/css-values/#valdef-length-dvw>
8265 Dvw,
8266 /// <https://drafts.csswg.org/css-values/#valdef-length-vh>
8267 Vh,
8268 /// <https://drafts.csswg.org/css-values/#valdef-length-svh>
8269 Svh,
8270 /// <https://drafts.csswg.org/css-values/#valdef-length-lvh>
8271 Lvh,
8272 /// <https://drafts.csswg.org/css-values/#valdef-length-dvh>
8273 Dvh,
8274 /// <https://drafts.csswg.org/css-values/#valdef-length-vmin>
8275 Vmin,
8276 /// <https://drafts.csswg.org/css-values/#valdef-length-svmin>
8277 Svmin,
8278 /// <https://drafts.csswg.org/css-values/#valdef-length-lvmin>
8279 Lvmin,
8280 /// <https://drafts.csswg.org/css-values/#valdef-length-dvmin>
8281 Dvmin,
8282 /// <https://drafts.csswg.org/css-values/#valdef-length-vmax>
8283 Vmax,
8284 /// <https://drafts.csswg.org/css-values/#valdef-length-svmax>
8285 Svmax,
8286 /// <https://drafts.csswg.org/css-values/#valdef-length-lvmax>
8287 Lvmax,
8288 /// <https://drafts.csswg.org/css-values/#valdef-length-dvmax>
8289 Dvmax,
8290 /// <https://drafts.csswg.org/css-values/#valdef-length-vb>
8291 Vb,
8292 /// <https://drafts.csswg.org/css-values/#valdef-length-svb>
8293 Svb,
8294 /// <https://drafts.csswg.org/css-values/#valdef-length-lvb>
8295 Lvb,
8296 /// <https://drafts.csswg.org/css-values/#valdef-length-dvb>
8297 Dvb,
8298 /// <https://drafts.csswg.org/css-values/#valdef-length-vi>
8299 Vi,
8300 /// <https://drafts.csswg.org/css-values/#valdef-length-svi>
8301 Svi,
8302 /// <https://drafts.csswg.org/css-values/#valdef-length-lvi>
8303 Lvi,
8304 /// <https://drafts.csswg.org/css-values/#valdef-length-dvi>
8305 Dvi,
8306 };
8307
8308 struct Vw_Body {
8309 Tag tag;
8310 StyleCSSFloat _0;
8311
8312 bool operator==(const Vw_Body& other) const {
8313 return _0 == other._0;
8314 }
8315 bool operator!=(const Vw_Body& other) const {
8316 return _0 != other._0;
8317 }
8318 };
8319
8320 struct Svw_Body {
8321 Tag tag;
8322 StyleCSSFloat _0;
8323
8324 bool operator==(const Svw_Body& other) const {
8325 return _0 == other._0;
8326 }
8327 bool operator!=(const Svw_Body& other) const {
8328 return _0 != other._0;
8329 }
8330 };
8331
8332 struct Lvw_Body {
8333 Tag tag;
8334 StyleCSSFloat _0;
8335
8336 bool operator==(const Lvw_Body& other) const {
8337 return _0 == other._0;
8338 }
8339 bool operator!=(const Lvw_Body& other) const {
8340 return _0 != other._0;
8341 }
8342 };
8343
8344 struct Dvw_Body {
8345 Tag tag;
8346 StyleCSSFloat _0;
8347
8348 bool operator==(const Dvw_Body& other) const {
8349 return _0 == other._0;
8350 }
8351 bool operator!=(const Dvw_Body& other) const {
8352 return _0 != other._0;
8353 }
8354 };
8355
8356 struct Vh_Body {
8357 Tag tag;
8358 StyleCSSFloat _0;
8359
8360 bool operator==(const Vh_Body& other) const {
8361 return _0 == other._0;
8362 }
8363 bool operator!=(const Vh_Body& other) const {
8364 return _0 != other._0;
8365 }
8366 };
8367
8368 struct Svh_Body {
8369 Tag tag;
8370 StyleCSSFloat _0;
8371
8372 bool operator==(const Svh_Body& other) const {
8373 return _0 == other._0;
8374 }
8375 bool operator!=(const Svh_Body& other) const {
8376 return _0 != other._0;
8377 }
8378 };
8379
8380 struct Lvh_Body {
8381 Tag tag;
8382 StyleCSSFloat _0;
8383
8384 bool operator==(const Lvh_Body& other) const {
8385 return _0 == other._0;
8386 }
8387 bool operator!=(const Lvh_Body& other) const {
8388 return _0 != other._0;
8389 }
8390 };
8391
8392 struct Dvh_Body {
8393 Tag tag;
8394 StyleCSSFloat _0;
8395
8396 bool operator==(const Dvh_Body& other) const {
8397 return _0 == other._0;
8398 }
8399 bool operator!=(const Dvh_Body& other) const {
8400 return _0 != other._0;
8401 }
8402 };
8403
8404 struct Vmin_Body {
8405 Tag tag;
8406 StyleCSSFloat _0;
8407
8408 bool operator==(const Vmin_Body& other) const {
8409 return _0 == other._0;
8410 }
8411 bool operator!=(const Vmin_Body& other) const {
8412 return _0 != other._0;
8413 }
8414 };
8415
8416 struct Svmin_Body {
8417 Tag tag;
8418 StyleCSSFloat _0;
8419
8420 bool operator==(const Svmin_Body& other) const {
8421 return _0 == other._0;
8422 }
8423 bool operator!=(const Svmin_Body& other) const {
8424 return _0 != other._0;
8425 }
8426 };
8427
8428 struct Lvmin_Body {
8429 Tag tag;
8430 StyleCSSFloat _0;
8431
8432 bool operator==(const Lvmin_Body& other) const {
8433 return _0 == other._0;
8434 }
8435 bool operator!=(const Lvmin_Body& other) const {
8436 return _0 != other._0;
8437 }
8438 };
8439
8440 struct Dvmin_Body {
8441 Tag tag;
8442 StyleCSSFloat _0;
8443
8444 bool operator==(const Dvmin_Body& other) const {
8445 return _0 == other._0;
8446 }
8447 bool operator!=(const Dvmin_Body& other) const {
8448 return _0 != other._0;
8449 }
8450 };
8451
8452 struct Vmax_Body {
8453 Tag tag;
8454 StyleCSSFloat _0;
8455
8456 bool operator==(const Vmax_Body& other) const {
8457 return _0 == other._0;
8458 }
8459 bool operator!=(const Vmax_Body& other) const {
8460 return _0 != other._0;
8461 }
8462 };
8463
8464 struct Svmax_Body {
8465 Tag tag;
8466 StyleCSSFloat _0;
8467
8468 bool operator==(const Svmax_Body& other) const {
8469 return _0 == other._0;
8470 }
8471 bool operator!=(const Svmax_Body& other) const {
8472 return _0 != other._0;
8473 }
8474 };
8475
8476 struct Lvmax_Body {
8477 Tag tag;
8478 StyleCSSFloat _0;
8479
8480 bool operator==(const Lvmax_Body& other) const {
8481 return _0 == other._0;
8482 }
8483 bool operator!=(const Lvmax_Body& other) const {
8484 return _0 != other._0;
8485 }
8486 };
8487
8488 struct Dvmax_Body {
8489 Tag tag;
8490 StyleCSSFloat _0;
8491
8492 bool operator==(const Dvmax_Body& other) const {
8493 return _0 == other._0;
8494 }
8495 bool operator!=(const Dvmax_Body& other) const {
8496 return _0 != other._0;
8497 }
8498 };
8499
8500 struct Vb_Body {
8501 Tag tag;
8502 StyleCSSFloat _0;
8503
8504 bool operator==(const Vb_Body& other) const {
8505 return _0 == other._0;
8506 }
8507 bool operator!=(const Vb_Body& other) const {
8508 return _0 != other._0;
8509 }
8510 };
8511
8512 struct Svb_Body {
8513 Tag tag;
8514 StyleCSSFloat _0;
8515
8516 bool operator==(const Svb_Body& other) const {
8517 return _0 == other._0;
8518 }
8519 bool operator!=(const Svb_Body& other) const {
8520 return _0 != other._0;
8521 }
8522 };
8523
8524 struct Lvb_Body {
8525 Tag tag;
8526 StyleCSSFloat _0;
8527
8528 bool operator==(const Lvb_Body& other) const {
8529 return _0 == other._0;
8530 }
8531 bool operator!=(const Lvb_Body& other) const {
8532 return _0 != other._0;
8533 }
8534 };
8535
8536 struct Dvb_Body {
8537 Tag tag;
8538 StyleCSSFloat _0;
8539
8540 bool operator==(const Dvb_Body& other) const {
8541 return _0 == other._0;
8542 }
8543 bool operator!=(const Dvb_Body& other) const {
8544 return _0 != other._0;
8545 }
8546 };
8547
8548 struct Vi_Body {
8549 Tag tag;
8550 StyleCSSFloat _0;
8551
8552 bool operator==(const Vi_Body& other) const {
8553 return _0 == other._0;
8554 }
8555 bool operator!=(const Vi_Body& other) const {
8556 return _0 != other._0;
8557 }
8558 };
8559
8560 struct Svi_Body {
8561 Tag tag;
8562 StyleCSSFloat _0;
8563
8564 bool operator==(const Svi_Body& other) const {
8565 return _0 == other._0;
8566 }
8567 bool operator!=(const Svi_Body& other) const {
8568 return _0 != other._0;
8569 }
8570 };
8571
8572 struct Lvi_Body {
8573 Tag tag;
8574 StyleCSSFloat _0;
8575
8576 bool operator==(const Lvi_Body& other) const {
8577 return _0 == other._0;
8578 }
8579 bool operator!=(const Lvi_Body& other) const {
8580 return _0 != other._0;
8581 }
8582 };
8583
8584 struct Dvi_Body {
8585 Tag tag;
8586 StyleCSSFloat _0;
8587
8588 bool operator==(const Dvi_Body& other) const {
8589 return _0 == other._0;
8590 }
8591 bool operator!=(const Dvi_Body& other) const {
8592 return _0 != other._0;
8593 }
8594 };
8595
8596 struct {
8597 Tag tag;
8598 };
8599 Vw_Body vw;
8600 Svw_Body svw;
8601 Lvw_Body lvw;
8602 Dvw_Body dvw;
8603 Vh_Body vh;
8604 Svh_Body svh;
8605 Lvh_Body lvh;
8606 Dvh_Body dvh;
8607 Vmin_Body vmin;
8608 Svmin_Body svmin;
8609 Lvmin_Body lvmin;
8610 Dvmin_Body dvmin;
8611 Vmax_Body vmax;
8612 Svmax_Body svmax;
8613 Lvmax_Body lvmax;
8614 Dvmax_Body dvmax;
8615 Vb_Body vb;
8616 Svb_Body svb;
8617 Lvb_Body lvb;
8618 Dvb_Body dvb;
8619 Vi_Body vi;
8620 Svi_Body svi;
8621 Lvi_Body lvi;
8622 Dvi_Body dvi;
8623
8624 static StyleViewportPercentageLength Vw(const StyleCSSFloat &_0) {
8625 StyleViewportPercentageLength result;
8626 ::new (&result.vw._0) (StyleCSSFloat)(_0);
8627 result.tag = Tag::Vw;
8628 return result;
8629 }
8630
8631 bool IsVw() const {
8632 return tag == Tag::Vw;
8633 }
8634
8635 const StyleCSSFloat& AsVw() const {
8636 MOZ_DIAGNOSTIC_ASSERT(IsVw())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsVw())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsVw()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsVw()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8636); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsVw()"
")"); do { *((volatile int*)__null) = 8636; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8637 return vw._0;
8638 }
8639
8640 static StyleViewportPercentageLength Svw(const StyleCSSFloat &_0) {
8641 StyleViewportPercentageLength result;
8642 ::new (&result.svw._0) (StyleCSSFloat)(_0);
8643 result.tag = Tag::Svw;
8644 return result;
8645 }
8646
8647 bool IsSvw() const {
8648 return tag == Tag::Svw;
8649 }
8650
8651 const StyleCSSFloat& AsSvw() const {
8652 MOZ_DIAGNOSTIC_ASSERT(IsSvw())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSvw())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSvw()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSvw()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8652); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSvw()"
")"); do { *((volatile int*)__null) = 8652; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8653 return svw._0;
8654 }
8655
8656 static StyleViewportPercentageLength Lvw(const StyleCSSFloat &_0) {
8657 StyleViewportPercentageLength result;
8658 ::new (&result.lvw._0) (StyleCSSFloat)(_0);
8659 result.tag = Tag::Lvw;
8660 return result;
8661 }
8662
8663 bool IsLvw() const {
8664 return tag == Tag::Lvw;
8665 }
8666
8667 const StyleCSSFloat& AsLvw() const {
8668 MOZ_DIAGNOSTIC_ASSERT(IsLvw())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLvw())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLvw()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLvw()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8668); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLvw()"
")"); do { *((volatile int*)__null) = 8668; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8669 return lvw._0;
8670 }
8671
8672 static StyleViewportPercentageLength Dvw(const StyleCSSFloat &_0) {
8673 StyleViewportPercentageLength result;
8674 ::new (&result.dvw._0) (StyleCSSFloat)(_0);
8675 result.tag = Tag::Dvw;
8676 return result;
8677 }
8678
8679 bool IsDvw() const {
8680 return tag == Tag::Dvw;
8681 }
8682
8683 const StyleCSSFloat& AsDvw() const {
8684 MOZ_DIAGNOSTIC_ASSERT(IsDvw())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsDvw())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsDvw()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsDvw()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8684); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsDvw()"
")"); do { *((volatile int*)__null) = 8684; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8685 return dvw._0;
8686 }
8687
8688 static StyleViewportPercentageLength Vh(const StyleCSSFloat &_0) {
8689 StyleViewportPercentageLength result;
8690 ::new (&result.vh._0) (StyleCSSFloat)(_0);
8691 result.tag = Tag::Vh;
8692 return result;
8693 }
8694
8695 bool IsVh() const {
8696 return tag == Tag::Vh;
8697 }
8698
8699 const StyleCSSFloat& AsVh() const {
8700 MOZ_DIAGNOSTIC_ASSERT(IsVh())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsVh())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsVh()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsVh()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8700); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsVh()"
")"); do { *((volatile int*)__null) = 8700; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8701 return vh._0;
8702 }
8703
8704 static StyleViewportPercentageLength Svh(const StyleCSSFloat &_0) {
8705 StyleViewportPercentageLength result;
8706 ::new (&result.svh._0) (StyleCSSFloat)(_0);
8707 result.tag = Tag::Svh;
8708 return result;
8709 }
8710
8711 bool IsSvh() const {
8712 return tag == Tag::Svh;
8713 }
8714
8715 const StyleCSSFloat& AsSvh() const {
8716 MOZ_DIAGNOSTIC_ASSERT(IsSvh())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSvh())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSvh()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSvh()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8716); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSvh()"
")"); do { *((volatile int*)__null) = 8716; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8717 return svh._0;
8718 }
8719
8720 static StyleViewportPercentageLength Lvh(const StyleCSSFloat &_0) {
8721 StyleViewportPercentageLength result;
8722 ::new (&result.lvh._0) (StyleCSSFloat)(_0);
8723 result.tag = Tag::Lvh;
8724 return result;
8725 }
8726
8727 bool IsLvh() const {
8728 return tag == Tag::Lvh;
8729 }
8730
8731 const StyleCSSFloat& AsLvh() const {
8732 MOZ_DIAGNOSTIC_ASSERT(IsLvh())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLvh())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLvh()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLvh()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8732); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLvh()"
")"); do { *((volatile int*)__null) = 8732; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8733 return lvh._0;
8734 }
8735
8736 static StyleViewportPercentageLength Dvh(const StyleCSSFloat &_0) {
8737 StyleViewportPercentageLength result;
8738 ::new (&result.dvh._0) (StyleCSSFloat)(_0);
8739 result.tag = Tag::Dvh;
8740 return result;
8741 }
8742
8743 bool IsDvh() const {
8744 return tag == Tag::Dvh;
8745 }
8746
8747 const StyleCSSFloat& AsDvh() const {
8748 MOZ_DIAGNOSTIC_ASSERT(IsDvh())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsDvh())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsDvh()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsDvh()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8748); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsDvh()"
")"); do { *((volatile int*)__null) = 8748; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8749 return dvh._0;
8750 }
8751
8752 static StyleViewportPercentageLength Vmin(const StyleCSSFloat &_0) {
8753 StyleViewportPercentageLength result;
8754 ::new (&result.vmin._0) (StyleCSSFloat)(_0);
8755 result.tag = Tag::Vmin;
8756 return result;
8757 }
8758
8759 bool IsVmin() const {
8760 return tag == Tag::Vmin;
8761 }
8762
8763 const StyleCSSFloat& AsVmin() const {
8764 MOZ_DIAGNOSTIC_ASSERT(IsVmin())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsVmin())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsVmin()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsVmin()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8764); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsVmin()"
")"); do { *((volatile int*)__null) = 8764; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8765 return vmin._0;
8766 }
8767
8768 static StyleViewportPercentageLength Svmin(const StyleCSSFloat &_0) {
8769 StyleViewportPercentageLength result;
8770 ::new (&result.svmin._0) (StyleCSSFloat)(_0);
8771 result.tag = Tag::Svmin;
8772 return result;
8773 }
8774
8775 bool IsSvmin() const {
8776 return tag == Tag::Svmin;
8777 }
8778
8779 const StyleCSSFloat& AsSvmin() const {
8780 MOZ_DIAGNOSTIC_ASSERT(IsSvmin())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSvmin())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSvmin()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSvmin()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8780); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSvmin()"
")"); do { *((volatile int*)__null) = 8780; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8781 return svmin._0;
8782 }
8783
8784 static StyleViewportPercentageLength Lvmin(const StyleCSSFloat &_0) {
8785 StyleViewportPercentageLength result;
8786 ::new (&result.lvmin._0) (StyleCSSFloat)(_0);
8787 result.tag = Tag::Lvmin;
8788 return result;
8789 }
8790
8791 bool IsLvmin() const {
8792 return tag == Tag::Lvmin;
8793 }
8794
8795 const StyleCSSFloat& AsLvmin() const {
8796 MOZ_DIAGNOSTIC_ASSERT(IsLvmin())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLvmin())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLvmin()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLvmin()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8796); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLvmin()"
")"); do { *((volatile int*)__null) = 8796; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8797 return lvmin._0;
8798 }
8799
8800 static StyleViewportPercentageLength Dvmin(const StyleCSSFloat &_0) {
8801 StyleViewportPercentageLength result;
8802 ::new (&result.dvmin._0) (StyleCSSFloat)(_0);
8803 result.tag = Tag::Dvmin;
8804 return result;
8805 }
8806
8807 bool IsDvmin() const {
8808 return tag == Tag::Dvmin;
8809 }
8810
8811 const StyleCSSFloat& AsDvmin() const {
8812 MOZ_DIAGNOSTIC_ASSERT(IsDvmin())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsDvmin())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsDvmin()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsDvmin()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8812); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsDvmin()"
")"); do { *((volatile int*)__null) = 8812; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8813 return dvmin._0;
8814 }
8815
8816 static StyleViewportPercentageLength Vmax(const StyleCSSFloat &_0) {
8817 StyleViewportPercentageLength result;
8818 ::new (&result.vmax._0) (StyleCSSFloat)(_0);
8819 result.tag = Tag::Vmax;
8820 return result;
8821 }
8822
8823 bool IsVmax() const {
8824 return tag == Tag::Vmax;
8825 }
8826
8827 const StyleCSSFloat& AsVmax() const {
8828 MOZ_DIAGNOSTIC_ASSERT(IsVmax())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsVmax())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsVmax()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsVmax()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8828); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsVmax()"
")"); do { *((volatile int*)__null) = 8828; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8829 return vmax._0;
8830 }
8831
8832 static StyleViewportPercentageLength Svmax(const StyleCSSFloat &_0) {
8833 StyleViewportPercentageLength result;
8834 ::new (&result.svmax._0) (StyleCSSFloat)(_0);
8835 result.tag = Tag::Svmax;
8836 return result;
8837 }
8838
8839 bool IsSvmax() const {
8840 return tag == Tag::Svmax;
8841 }
8842
8843 const StyleCSSFloat& AsSvmax() const {
8844 MOZ_DIAGNOSTIC_ASSERT(IsSvmax())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSvmax())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSvmax()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSvmax()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8844); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSvmax()"
")"); do { *((volatile int*)__null) = 8844; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8845 return svmax._0;
8846 }
8847
8848 static StyleViewportPercentageLength Lvmax(const StyleCSSFloat &_0) {
8849 StyleViewportPercentageLength result;
8850 ::new (&result.lvmax._0) (StyleCSSFloat)(_0);
8851 result.tag = Tag::Lvmax;
8852 return result;
8853 }
8854
8855 bool IsLvmax() const {
8856 return tag == Tag::Lvmax;
8857 }
8858
8859 const StyleCSSFloat& AsLvmax() const {
8860 MOZ_DIAGNOSTIC_ASSERT(IsLvmax())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLvmax())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLvmax()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLvmax()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8860); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLvmax()"
")"); do { *((volatile int*)__null) = 8860; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8861 return lvmax._0;
8862 }
8863
8864 static StyleViewportPercentageLength Dvmax(const StyleCSSFloat &_0) {
8865 StyleViewportPercentageLength result;
8866 ::new (&result.dvmax._0) (StyleCSSFloat)(_0);
8867 result.tag = Tag::Dvmax;
8868 return result;
8869 }
8870
8871 bool IsDvmax() const {
8872 return tag == Tag::Dvmax;
8873 }
8874
8875 const StyleCSSFloat& AsDvmax() const {
8876 MOZ_DIAGNOSTIC_ASSERT(IsDvmax())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsDvmax())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsDvmax()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsDvmax()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8876); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsDvmax()"
")"); do { *((volatile int*)__null) = 8876; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8877 return dvmax._0;
8878 }
8879
8880 static StyleViewportPercentageLength Vb(const StyleCSSFloat &_0) {
8881 StyleViewportPercentageLength result;
8882 ::new (&result.vb._0) (StyleCSSFloat)(_0);
8883 result.tag = Tag::Vb;
8884 return result;
8885 }
8886
8887 bool IsVb() const {
8888 return tag == Tag::Vb;
8889 }
8890
8891 const StyleCSSFloat& AsVb() const {
8892 MOZ_DIAGNOSTIC_ASSERT(IsVb())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsVb())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsVb()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsVb()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8892); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsVb()"
")"); do { *((volatile int*)__null) = 8892; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8893 return vb._0;
8894 }
8895
8896 static StyleViewportPercentageLength Svb(const StyleCSSFloat &_0) {
8897 StyleViewportPercentageLength result;
8898 ::new (&result.svb._0) (StyleCSSFloat)(_0);
8899 result.tag = Tag::Svb;
8900 return result;
8901 }
8902
8903 bool IsSvb() const {
8904 return tag == Tag::Svb;
8905 }
8906
8907 const StyleCSSFloat& AsSvb() const {
8908 MOZ_DIAGNOSTIC_ASSERT(IsSvb())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSvb())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSvb()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSvb()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8908); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSvb()"
")"); do { *((volatile int*)__null) = 8908; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8909 return svb._0;
8910 }
8911
8912 static StyleViewportPercentageLength Lvb(const StyleCSSFloat &_0) {
8913 StyleViewportPercentageLength result;
8914 ::new (&result.lvb._0) (StyleCSSFloat)(_0);
8915 result.tag = Tag::Lvb;
8916 return result;
8917 }
8918
8919 bool IsLvb() const {
8920 return tag == Tag::Lvb;
8921 }
8922
8923 const StyleCSSFloat& AsLvb() const {
8924 MOZ_DIAGNOSTIC_ASSERT(IsLvb())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLvb())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLvb()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLvb()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8924); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLvb()"
")"); do { *((volatile int*)__null) = 8924; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8925 return lvb._0;
8926 }
8927
8928 static StyleViewportPercentageLength Dvb(const StyleCSSFloat &_0) {
8929 StyleViewportPercentageLength result;
8930 ::new (&result.dvb._0) (StyleCSSFloat)(_0);
8931 result.tag = Tag::Dvb;
8932 return result;
8933 }
8934
8935 bool IsDvb() const {
8936 return tag == Tag::Dvb;
8937 }
8938
8939 const StyleCSSFloat& AsDvb() const {
8940 MOZ_DIAGNOSTIC_ASSERT(IsDvb())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsDvb())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsDvb()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsDvb()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8940); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsDvb()"
")"); do { *((volatile int*)__null) = 8940; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8941 return dvb._0;
8942 }
8943
8944 static StyleViewportPercentageLength Vi(const StyleCSSFloat &_0) {
8945 StyleViewportPercentageLength result;
8946 ::new (&result.vi._0) (StyleCSSFloat)(_0);
8947 result.tag = Tag::Vi;
8948 return result;
8949 }
8950
8951 bool IsVi() const {
8952 return tag == Tag::Vi;
8953 }
8954
8955 const StyleCSSFloat& AsVi() const {
8956 MOZ_DIAGNOSTIC_ASSERT(IsVi())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsVi())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsVi()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsVi()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8956); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsVi()"
")"); do { *((volatile int*)__null) = 8956; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8957 return vi._0;
8958 }
8959
8960 static StyleViewportPercentageLength Svi(const StyleCSSFloat &_0) {
8961 StyleViewportPercentageLength result;
8962 ::new (&result.svi._0) (StyleCSSFloat)(_0);
8963 result.tag = Tag::Svi;
8964 return result;
8965 }
8966
8967 bool IsSvi() const {
8968 return tag == Tag::Svi;
8969 }
8970
8971 const StyleCSSFloat& AsSvi() const {
8972 MOZ_DIAGNOSTIC_ASSERT(IsSvi())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSvi())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSvi()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSvi()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8972); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSvi()"
")"); do { *((volatile int*)__null) = 8972; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8973 return svi._0;
8974 }
8975
8976 static StyleViewportPercentageLength Lvi(const StyleCSSFloat &_0) {
8977 StyleViewportPercentageLength result;
8978 ::new (&result.lvi._0) (StyleCSSFloat)(_0);
8979 result.tag = Tag::Lvi;
8980 return result;
8981 }
8982
8983 bool IsLvi() const {
8984 return tag == Tag::Lvi;
8985 }
8986
8987 const StyleCSSFloat& AsLvi() const {
8988 MOZ_DIAGNOSTIC_ASSERT(IsLvi())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLvi())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLvi()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLvi()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 8988); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLvi()"
")"); do { *((volatile int*)__null) = 8988; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
8989 return lvi._0;
8990 }
8991
8992 static StyleViewportPercentageLength Dvi(const StyleCSSFloat &_0) {
8993 StyleViewportPercentageLength result;
8994 ::new (&result.dvi._0) (StyleCSSFloat)(_0);
8995 result.tag = Tag::Dvi;
8996 return result;
8997 }
8998
8999 bool IsDvi() const {
9000 return tag == Tag::Dvi;
9001 }
9002
9003 const StyleCSSFloat& AsDvi() const {
9004 MOZ_DIAGNOSTIC_ASSERT(IsDvi())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsDvi())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsDvi()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsDvi()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9004); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsDvi()"
")"); do { *((volatile int*)__null) = 9004; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9005 return dvi._0;
9006 }
9007
9008 bool operator==(const StyleViewportPercentageLength& other) const {
9009 if (tag != other.tag) {
9010 return false;
9011 }
9012 switch (tag) {
9013 case Tag::Vw: return vw == other.vw;
9014 case Tag::Svw: return svw == other.svw;
9015 case Tag::Lvw: return lvw == other.lvw;
9016 case Tag::Dvw: return dvw == other.dvw;
9017 case Tag::Vh: return vh == other.vh;
9018 case Tag::Svh: return svh == other.svh;
9019 case Tag::Lvh: return lvh == other.lvh;
9020 case Tag::Dvh: return dvh == other.dvh;
9021 case Tag::Vmin: return vmin == other.vmin;
9022 case Tag::Svmin: return svmin == other.svmin;
9023 case Tag::Lvmin: return lvmin == other.lvmin;
9024 case Tag::Dvmin: return dvmin == other.dvmin;
9025 case Tag::Vmax: return vmax == other.vmax;
9026 case Tag::Svmax: return svmax == other.svmax;
9027 case Tag::Lvmax: return lvmax == other.lvmax;
9028 case Tag::Dvmax: return dvmax == other.dvmax;
9029 case Tag::Vb: return vb == other.vb;
9030 case Tag::Svb: return svb == other.svb;
9031 case Tag::Lvb: return lvb == other.lvb;
9032 case Tag::Dvb: return dvb == other.dvb;
9033 case Tag::Vi: return vi == other.vi;
9034 case Tag::Svi: return svi == other.svi;
9035 case Tag::Lvi: return lvi == other.lvi;
9036 case Tag::Dvi: return dvi == other.dvi;
9037
9038 }
9039 return true;
9040 }
9041
9042 bool operator!=(const StyleViewportPercentageLength& other) const {
9043 return !(*this == other);
9044 }
9045
9046 private:
9047 StyleViewportPercentageLength() {
9048
9049 }
9050 public:
9051
9052
9053 ~StyleViewportPercentageLength() {
9054 switch (tag) {
9055 case Tag::Vw: vw.~Vw_Body(); break;
9056 case Tag::Svw: svw.~Svw_Body(); break;
9057 case Tag::Lvw: lvw.~Lvw_Body(); break;
9058 case Tag::Dvw: dvw.~Dvw_Body(); break;
9059 case Tag::Vh: vh.~Vh_Body(); break;
9060 case Tag::Svh: svh.~Svh_Body(); break;
9061 case Tag::Lvh: lvh.~Lvh_Body(); break;
9062 case Tag::Dvh: dvh.~Dvh_Body(); break;
9063 case Tag::Vmin: vmin.~Vmin_Body(); break;
9064 case Tag::Svmin: svmin.~Svmin_Body(); break;
9065 case Tag::Lvmin: lvmin.~Lvmin_Body(); break;
9066 case Tag::Dvmin: dvmin.~Dvmin_Body(); break;
9067 case Tag::Vmax: vmax.~Vmax_Body(); break;
9068 case Tag::Svmax: svmax.~Svmax_Body(); break;
9069 case Tag::Lvmax: lvmax.~Lvmax_Body(); break;
9070 case Tag::Dvmax: dvmax.~Dvmax_Body(); break;
9071 case Tag::Vb: vb.~Vb_Body(); break;
9072 case Tag::Svb: svb.~Svb_Body(); break;
9073 case Tag::Lvb: lvb.~Lvb_Body(); break;
9074 case Tag::Dvb: dvb.~Dvb_Body(); break;
9075 case Tag::Vi: vi.~Vi_Body(); break;
9076 case Tag::Svi: svi.~Svi_Body(); break;
9077 case Tag::Lvi: lvi.~Lvi_Body(); break;
9078 case Tag::Dvi: dvi.~Dvi_Body(); break;
9079
9080 }
9081 }
9082
9083 StyleViewportPercentageLength(const StyleViewportPercentageLength& other)
9084 : tag(other.tag) {
9085 switch (tag) {
9086 case Tag::Vw: ::new (&vw) (Vw_Body)(other.vw); break;
9087 case Tag::Svw: ::new (&svw) (Svw_Body)(other.svw); break;
9088 case Tag::Lvw: ::new (&lvw) (Lvw_Body)(other.lvw); break;
9089 case Tag::Dvw: ::new (&dvw) (Dvw_Body)(other.dvw); break;
9090 case Tag::Vh: ::new (&vh) (Vh_Body)(other.vh); break;
9091 case Tag::Svh: ::new (&svh) (Svh_Body)(other.svh); break;
9092 case Tag::Lvh: ::new (&lvh) (Lvh_Body)(other.lvh); break;
9093 case Tag::Dvh: ::new (&dvh) (Dvh_Body)(other.dvh); break;
9094 case Tag::Vmin: ::new (&vmin) (Vmin_Body)(other.vmin); break;
9095 case Tag::Svmin: ::new (&svmin) (Svmin_Body)(other.svmin); break;
9096 case Tag::Lvmin: ::new (&lvmin) (Lvmin_Body)(other.lvmin); break;
9097 case Tag::Dvmin: ::new (&dvmin) (Dvmin_Body)(other.dvmin); break;
9098 case Tag::Vmax: ::new (&vmax) (Vmax_Body)(other.vmax); break;
9099 case Tag::Svmax: ::new (&svmax) (Svmax_Body)(other.svmax); break;
9100 case Tag::Lvmax: ::new (&lvmax) (Lvmax_Body)(other.lvmax); break;
9101 case Tag::Dvmax: ::new (&dvmax) (Dvmax_Body)(other.dvmax); break;
9102 case Tag::Vb: ::new (&vb) (Vb_Body)(other.vb); break;
9103 case Tag::Svb: ::new (&svb) (Svb_Body)(other.svb); break;
9104 case Tag::Lvb: ::new (&lvb) (Lvb_Body)(other.lvb); break;
9105 case Tag::Dvb: ::new (&dvb) (Dvb_Body)(other.dvb); break;
9106 case Tag::Vi: ::new (&vi) (Vi_Body)(other.vi); break;
9107 case Tag::Svi: ::new (&svi) (Svi_Body)(other.svi); break;
9108 case Tag::Lvi: ::new (&lvi) (Lvi_Body)(other.lvi); break;
9109 case Tag::Dvi: ::new (&dvi) (Dvi_Body)(other.dvi); break;
9110
9111 }
9112 }
9113 StyleViewportPercentageLength& operator=(const StyleViewportPercentageLength& other) {
9114 if (this != &other) {
9115 this->~StyleViewportPercentageLength();
9116 new (this) StyleViewportPercentageLength(other);
9117 }
9118 return *this;
9119 }
9120};
9121
9122/// A container query length.
9123///
9124/// <https://drafts.csswg.org/css-contain-3/#container-lengths>
9125union StyleContainerRelativeLength {
9126 enum class Tag : uint8_t {
9127 /// 1% of query container's width
9128 Cqw,
9129 /// 1% of query container's height
9130 Cqh,
9131 /// 1% of query container's inline size
9132 Cqi,
9133 /// 1% of query container's block size
9134 Cqb,
9135 /// The smaller value of `cqi` or `cqb`
9136 Cqmin,
9137 /// The larger value of `cqi` or `cqb`
9138 Cqmax,
9139 };
9140
9141 struct Cqw_Body {
9142 Tag tag;
9143 StyleCSSFloat _0;
9144
9145 bool operator==(const Cqw_Body& other) const {
9146 return _0 == other._0;
9147 }
9148 bool operator!=(const Cqw_Body& other) const {
9149 return _0 != other._0;
9150 }
9151 };
9152
9153 struct Cqh_Body {
9154 Tag tag;
9155 StyleCSSFloat _0;
9156
9157 bool operator==(const Cqh_Body& other) const {
9158 return _0 == other._0;
9159 }
9160 bool operator!=(const Cqh_Body& other) const {
9161 return _0 != other._0;
9162 }
9163 };
9164
9165 struct Cqi_Body {
9166 Tag tag;
9167 StyleCSSFloat _0;
9168
9169 bool operator==(const Cqi_Body& other) const {
9170 return _0 == other._0;
9171 }
9172 bool operator!=(const Cqi_Body& other) const {
9173 return _0 != other._0;
9174 }
9175 };
9176
9177 struct Cqb_Body {
9178 Tag tag;
9179 StyleCSSFloat _0;
9180
9181 bool operator==(const Cqb_Body& other) const {
9182 return _0 == other._0;
9183 }
9184 bool operator!=(const Cqb_Body& other) const {
9185 return _0 != other._0;
9186 }
9187 };
9188
9189 struct Cqmin_Body {
9190 Tag tag;
9191 StyleCSSFloat _0;
9192
9193 bool operator==(const Cqmin_Body& other) const {
9194 return _0 == other._0;
9195 }
9196 bool operator!=(const Cqmin_Body& other) const {
9197 return _0 != other._0;
9198 }
9199 };
9200
9201 struct Cqmax_Body {
9202 Tag tag;
9203 StyleCSSFloat _0;
9204
9205 bool operator==(const Cqmax_Body& other) const {
9206 return _0 == other._0;
9207 }
9208 bool operator!=(const Cqmax_Body& other) const {
9209 return _0 != other._0;
9210 }
9211 };
9212
9213 struct {
9214 Tag tag;
9215 };
9216 Cqw_Body cqw;
9217 Cqh_Body cqh;
9218 Cqi_Body cqi;
9219 Cqb_Body cqb;
9220 Cqmin_Body cqmin;
9221 Cqmax_Body cqmax;
9222
9223 static StyleContainerRelativeLength Cqw(const StyleCSSFloat &_0) {
9224 StyleContainerRelativeLength result;
9225 ::new (&result.cqw._0) (StyleCSSFloat)(_0);
9226 result.tag = Tag::Cqw;
9227 return result;
9228 }
9229
9230 bool IsCqw() const {
9231 return tag == Tag::Cqw;
9232 }
9233
9234 const StyleCSSFloat& AsCqw() const {
9235 MOZ_DIAGNOSTIC_ASSERT(IsCqw())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCqw())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCqw()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsCqw()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9235); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCqw()"
")"); do { *((volatile int*)__null) = 9235; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9236 return cqw._0;
9237 }
9238
9239 static StyleContainerRelativeLength Cqh(const StyleCSSFloat &_0) {
9240 StyleContainerRelativeLength result;
9241 ::new (&result.cqh._0) (StyleCSSFloat)(_0);
9242 result.tag = Tag::Cqh;
9243 return result;
9244 }
9245
9246 bool IsCqh() const {
9247 return tag == Tag::Cqh;
9248 }
9249
9250 const StyleCSSFloat& AsCqh() const {
9251 MOZ_DIAGNOSTIC_ASSERT(IsCqh())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCqh())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCqh()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsCqh()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9251); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCqh()"
")"); do { *((volatile int*)__null) = 9251; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9252 return cqh._0;
9253 }
9254
9255 static StyleContainerRelativeLength Cqi(const StyleCSSFloat &_0) {
9256 StyleContainerRelativeLength result;
9257 ::new (&result.cqi._0) (StyleCSSFloat)(_0);
9258 result.tag = Tag::Cqi;
9259 return result;
9260 }
9261
9262 bool IsCqi() const {
9263 return tag == Tag::Cqi;
9264 }
9265
9266 const StyleCSSFloat& AsCqi() const {
9267 MOZ_DIAGNOSTIC_ASSERT(IsCqi())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCqi())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCqi()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsCqi()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9267); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCqi()"
")"); do { *((volatile int*)__null) = 9267; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9268 return cqi._0;
9269 }
9270
9271 static StyleContainerRelativeLength Cqb(const StyleCSSFloat &_0) {
9272 StyleContainerRelativeLength result;
9273 ::new (&result.cqb._0) (StyleCSSFloat)(_0);
9274 result.tag = Tag::Cqb;
9275 return result;
9276 }
9277
9278 bool IsCqb() const {
9279 return tag == Tag::Cqb;
9280 }
9281
9282 const StyleCSSFloat& AsCqb() const {
9283 MOZ_DIAGNOSTIC_ASSERT(IsCqb())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCqb())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCqb()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsCqb()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9283); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCqb()"
")"); do { *((volatile int*)__null) = 9283; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9284 return cqb._0;
9285 }
9286
9287 static StyleContainerRelativeLength Cqmin(const StyleCSSFloat &_0) {
9288 StyleContainerRelativeLength result;
9289 ::new (&result.cqmin._0) (StyleCSSFloat)(_0);
9290 result.tag = Tag::Cqmin;
9291 return result;
9292 }
9293
9294 bool IsCqmin() const {
9295 return tag == Tag::Cqmin;
9296 }
9297
9298 const StyleCSSFloat& AsCqmin() const {
9299 MOZ_DIAGNOSTIC_ASSERT(IsCqmin())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCqmin())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCqmin()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsCqmin()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9299); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCqmin()"
")"); do { *((volatile int*)__null) = 9299; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9300 return cqmin._0;
9301 }
9302
9303 static StyleContainerRelativeLength Cqmax(const StyleCSSFloat &_0) {
9304 StyleContainerRelativeLength result;
9305 ::new (&result.cqmax._0) (StyleCSSFloat)(_0);
9306 result.tag = Tag::Cqmax;
9307 return result;
9308 }
9309
9310 bool IsCqmax() const {
9311 return tag == Tag::Cqmax;
9312 }
9313
9314 const StyleCSSFloat& AsCqmax() const {
9315 MOZ_DIAGNOSTIC_ASSERT(IsCqmax())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCqmax())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCqmax()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsCqmax()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9315); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCqmax()"
")"); do { *((volatile int*)__null) = 9315; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9316 return cqmax._0;
9317 }
9318
9319 bool operator==(const StyleContainerRelativeLength& other) const {
9320 if (tag != other.tag) {
9321 return false;
9322 }
9323 switch (tag) {
9324 case Tag::Cqw: return cqw == other.cqw;
9325 case Tag::Cqh: return cqh == other.cqh;
9326 case Tag::Cqi: return cqi == other.cqi;
9327 case Tag::Cqb: return cqb == other.cqb;
9328 case Tag::Cqmin: return cqmin == other.cqmin;
9329 case Tag::Cqmax: return cqmax == other.cqmax;
9330
9331 }
9332 return true;
9333 }
9334
9335 bool operator!=(const StyleContainerRelativeLength& other) const {
9336 return !(*this == other);
9337 }
9338
9339 private:
9340 StyleContainerRelativeLength() {
9341
9342 }
9343 public:
9344
9345
9346 ~StyleContainerRelativeLength() {
9347 switch (tag) {
9348 case Tag::Cqw: cqw.~Cqw_Body(); break;
9349 case Tag::Cqh: cqh.~Cqh_Body(); break;
9350 case Tag::Cqi: cqi.~Cqi_Body(); break;
9351 case Tag::Cqb: cqb.~Cqb_Body(); break;
9352 case Tag::Cqmin: cqmin.~Cqmin_Body(); break;
9353 case Tag::Cqmax: cqmax.~Cqmax_Body(); break;
9354
9355 }
9356 }
9357
9358 StyleContainerRelativeLength(const StyleContainerRelativeLength& other)
9359 : tag(other.tag) {
9360 switch (tag) {
9361 case Tag::Cqw: ::new (&cqw) (Cqw_Body)(other.cqw); break;
9362 case Tag::Cqh: ::new (&cqh) (Cqh_Body)(other.cqh); break;
9363 case Tag::Cqi: ::new (&cqi) (Cqi_Body)(other.cqi); break;
9364 case Tag::Cqb: ::new (&cqb) (Cqb_Body)(other.cqb); break;
9365 case Tag::Cqmin: ::new (&cqmin) (Cqmin_Body)(other.cqmin); break;
9366 case Tag::Cqmax: ::new (&cqmax) (Cqmax_Body)(other.cqmax); break;
9367
9368 }
9369 }
9370 StyleContainerRelativeLength& operator=(const StyleContainerRelativeLength& other) {
9371 if (this != &other) {
9372 this->~StyleContainerRelativeLength();
9373 new (this) StyleContainerRelativeLength(other);
9374 }
9375 return *this;
9376 }
9377};
9378
9379/// HTML5 "character width", as defined in HTML5 § 14.5.4.
9380struct StyleCharacterWidth {
9381 int32_t _0;
9382
9383 bool operator==(const StyleCharacterWidth& other) const {
9384 return _0 == other._0;
9385 }
9386 bool operator!=(const StyleCharacterWidth& other) const {
9387 return _0 != other._0;
9388 }
9389};
9390
9391/// A `<length>` without taking `calc` expressions into account
9392///
9393/// <https://drafts.csswg.org/css-values/#lengths>
9394union StyleNoCalcLength {
9395 enum class Tag : uint8_t {
9396 /// An absolute length
9397 ///
9398 /// <https://drafts.csswg.org/css-values/#absolute-length>
9399 Absolute,
9400 /// A font-relative length:
9401 ///
9402 /// <https://drafts.csswg.org/css-values/#font-relative-lengths>
9403 FontRelative,
9404 /// A viewport-relative length.
9405 ///
9406 /// <https://drafts.csswg.org/css-values/#viewport-relative-lengths>
9407 ViewportPercentage,
9408 /// A container query length.
9409 ///
9410 /// <https://drafts.csswg.org/css-contain-3/#container-lengths>
9411 ContainerRelative,
9412 /// HTML5 "character width", as defined in HTML5 § 14.5.4.
9413 ///
9414 /// This cannot be specified by the user directly and is only generated by
9415 /// `Stylist::synthesize_rules_for_legacy_attributes()`.
9416 ServoCharacterWidth,
9417 };
9418
9419 struct Absolute_Body {
9420 Tag tag;
9421 StyleAbsoluteLength _0;
9422
9423 bool operator==(const Absolute_Body& other) const {
9424 return _0 == other._0;
9425 }
9426 bool operator!=(const Absolute_Body& other) const {
9427 return _0 != other._0;
9428 }
9429 };
9430
9431 struct FontRelative_Body {
9432 Tag tag;
9433 StyleFontRelativeLength _0;
9434
9435 bool operator==(const FontRelative_Body& other) const {
9436 return _0 == other._0;
9437 }
9438 bool operator!=(const FontRelative_Body& other) const {
9439 return _0 != other._0;
9440 }
9441 };
9442
9443 struct ViewportPercentage_Body {
9444 Tag tag;
9445 StyleViewportPercentageLength _0;
9446
9447 bool operator==(const ViewportPercentage_Body& other) const {
9448 return _0 == other._0;
9449 }
9450 bool operator!=(const ViewportPercentage_Body& other) const {
9451 return _0 != other._0;
9452 }
9453 };
9454
9455 struct ContainerRelative_Body {
9456 Tag tag;
9457 StyleContainerRelativeLength _0;
9458
9459 bool operator==(const ContainerRelative_Body& other) const {
9460 return _0 == other._0;
9461 }
9462 bool operator!=(const ContainerRelative_Body& other) const {
9463 return _0 != other._0;
9464 }
9465 };
9466
9467 struct ServoCharacterWidth_Body {
9468 Tag tag;
9469 StyleCharacterWidth _0;
9470
9471 bool operator==(const ServoCharacterWidth_Body& other) const {
9472 return _0 == other._0;
9473 }
9474 bool operator!=(const ServoCharacterWidth_Body& other) const {
9475 return _0 != other._0;
9476 }
9477 };
9478
9479 struct {
9480 Tag tag;
9481 };
9482 Absolute_Body absolute;
9483 FontRelative_Body font_relative;
9484 ViewportPercentage_Body viewport_percentage;
9485 ContainerRelative_Body container_relative;
9486 ServoCharacterWidth_Body servo_character_width;
9487
9488 static StyleNoCalcLength Absolute(const StyleAbsoluteLength &_0) {
9489 StyleNoCalcLength result;
9490 ::new (&result.absolute._0) (StyleAbsoluteLength)(_0);
9491 result.tag = Tag::Absolute;
9492 return result;
9493 }
9494
9495 bool IsAbsolute() const {
9496 return tag == Tag::Absolute;
9497 }
9498
9499 const StyleAbsoluteLength& AsAbsolute() const {
9500 MOZ_DIAGNOSTIC_ASSERT(IsAbsolute())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAbsolute())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAbsolute()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsAbsolute()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9500); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAbsolute()"
")"); do { *((volatile int*)__null) = 9500; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9501 return absolute._0;
9502 }
9503
9504 static StyleNoCalcLength FontRelative(const StyleFontRelativeLength &_0) {
9505 StyleNoCalcLength result;
9506 ::new (&result.font_relative._0) (StyleFontRelativeLength)(_0);
9507 result.tag = Tag::FontRelative;
9508 return result;
9509 }
9510
9511 bool IsFontRelative() const {
9512 return tag == Tag::FontRelative;
9513 }
9514
9515 const StyleFontRelativeLength& AsFontRelative() const {
9516 MOZ_DIAGNOSTIC_ASSERT(IsFontRelative())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsFontRelative())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsFontRelative()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsFontRelative()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9516); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsFontRelative()"
")"); do { *((volatile int*)__null) = 9516; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9517 return font_relative._0;
9518 }
9519
9520 static StyleNoCalcLength ViewportPercentage(const StyleViewportPercentageLength &_0) {
9521 StyleNoCalcLength result;
9522 ::new (&result.viewport_percentage._0) (StyleViewportPercentageLength)(_0);
9523 result.tag = Tag::ViewportPercentage;
9524 return result;
9525 }
9526
9527 bool IsViewportPercentage() const {
9528 return tag == Tag::ViewportPercentage;
9529 }
9530
9531 const StyleViewportPercentageLength& AsViewportPercentage() const {
9532 MOZ_DIAGNOSTIC_ASSERT(IsViewportPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsViewportPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsViewportPercentage()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("IsViewportPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9532); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsViewportPercentage()"
")"); do { *((volatile int*)__null) = 9532; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9533 return viewport_percentage._0;
9534 }
9535
9536 static StyleNoCalcLength ContainerRelative(const StyleContainerRelativeLength &_0) {
9537 StyleNoCalcLength result;
9538 ::new (&result.container_relative._0) (StyleContainerRelativeLength)(_0);
9539 result.tag = Tag::ContainerRelative;
9540 return result;
9541 }
9542
9543 bool IsContainerRelative() const {
9544 return tag == Tag::ContainerRelative;
9545 }
9546
9547 const StyleContainerRelativeLength& AsContainerRelative() const {
9548 MOZ_DIAGNOSTIC_ASSERT(IsContainerRelative())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsContainerRelative())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsContainerRelative()))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("IsContainerRelative()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9548); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsContainerRelative()"
")"); do { *((volatile int*)__null) = 9548; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9549 return container_relative._0;
9550 }
9551
9552 static StyleNoCalcLength ServoCharacterWidth(const StyleCharacterWidth &_0) {
9553 StyleNoCalcLength result;
9554 ::new (&result.servo_character_width._0) (StyleCharacterWidth)(_0);
9555 result.tag = Tag::ServoCharacterWidth;
9556 return result;
9557 }
9558
9559 bool IsServoCharacterWidth() const {
9560 return tag == Tag::ServoCharacterWidth;
9561 }
9562
9563 const StyleCharacterWidth& AsServoCharacterWidth() const {
9564 MOZ_DIAGNOSTIC_ASSERT(IsServoCharacterWidth())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsServoCharacterWidth())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsServoCharacterWidth()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("IsServoCharacterWidth()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9564); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsServoCharacterWidth()"
")"); do { *((volatile int*)__null) = 9564; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9565 return servo_character_width._0;
9566 }
9567
9568 bool operator==(const StyleNoCalcLength& other) const {
9569 if (tag != other.tag) {
9570 return false;
9571 }
9572 switch (tag) {
9573 case Tag::Absolute: return absolute == other.absolute;
9574 case Tag::FontRelative: return font_relative == other.font_relative;
9575 case Tag::ViewportPercentage: return viewport_percentage == other.viewport_percentage;
9576 case Tag::ContainerRelative: return container_relative == other.container_relative;
9577 case Tag::ServoCharacterWidth: return servo_character_width == other.servo_character_width;
9578
9579 }
9580 return true;
9581 }
9582
9583 bool operator!=(const StyleNoCalcLength& other) const {
9584 return !(*this == other);
9585 }
9586
9587 private:
9588 StyleNoCalcLength() {
9589
9590 }
9591 public:
9592
9593
9594 ~StyleNoCalcLength() {
9595 switch (tag) {
9596 case Tag::Absolute: absolute.~Absolute_Body(); break;
9597 case Tag::FontRelative: font_relative.~FontRelative_Body(); break;
9598 case Tag::ViewportPercentage: viewport_percentage.~ViewportPercentage_Body(); break;
9599 case Tag::ContainerRelative: container_relative.~ContainerRelative_Body(); break;
9600 case Tag::ServoCharacterWidth: servo_character_width.~ServoCharacterWidth_Body(); break;
9601
9602 }
9603 }
9604
9605 StyleNoCalcLength(const StyleNoCalcLength& other)
9606 : tag(other.tag) {
9607 switch (tag) {
9608 case Tag::Absolute: ::new (&absolute) (Absolute_Body)(other.absolute); break;
9609 case Tag::FontRelative: ::new (&font_relative) (FontRelative_Body)(other.font_relative); break;
9610 case Tag::ViewportPercentage: ::new (&viewport_percentage) (ViewportPercentage_Body)(other.viewport_percentage); break;
9611 case Tag::ContainerRelative: ::new (&container_relative) (ContainerRelative_Body)(other.container_relative); break;
9612 case Tag::ServoCharacterWidth: ::new (&servo_character_width) (ServoCharacterWidth_Body)(other.servo_character_width); break;
9613
9614 }
9615 }
9616 StyleNoCalcLength& operator=(const StyleNoCalcLength& other) {
9617 if (this != &other) {
9618 this->~StyleNoCalcLength();
9619 new (this) StyleNoCalcLength(other);
9620 }
9621 return *this;
9622 }
9623};
9624
9625/// A computed `<time>` value.
9626struct StyleTime {
9627 StyleCSSFloat seconds;
9628
9629 bool operator==(const StyleTime& other) const {
9630 return seconds == other.seconds;
9631 }
9632 bool operator!=(const StyleTime& other) const {
9633 return seconds != other.seconds;
9634 }
9635 float ToSeconds() const { return seconds; }
9636 float ToMilliseconds() const { return seconds * 1000.0f; }
9637};
9638
9639/// A computed `<resolution>`.
9640struct StyleResolution {
9641 StyleCSSFloat _0;
9642
9643 bool operator==(const StyleResolution& other) const {
9644 return _0 == other._0;
9645 }
9646 bool operator!=(const StyleResolution& other) const {
9647 return _0 != other._0;
9648 }
9649};
9650
9651/// A leaf node inside a `Calc` expression's AST.
9652union StyleLeaf {
9653 enum class Tag : uint8_t {
9654 /// `<length>`
9655 Length,
9656 /// `<angle>`
9657 Angle,
9658 /// `<time>`
9659 Time,
9660 /// `<resolution>`
9661 Resolution,
9662 /// A component of a color.
9663 ColorComponent,
9664 /// `<percentage>`
9665 Percentage,
9666 /// `<number>`
9667 Number,
9668 };
9669
9670 struct Length_Body {
9671 Tag tag;
9672 StyleNoCalcLength _0;
9673
9674 bool operator==(const Length_Body& other) const {
9675 return _0 == other._0;
9676 }
9677 bool operator!=(const Length_Body& other) const {
9678 return _0 != other._0;
9679 }
9680 };
9681
9682 struct Angle_Body {
9683 Tag tag;
9684 StyleAngle _0;
9685
9686 bool operator==(const Angle_Body& other) const {
9687 return _0 == other._0;
9688 }
9689 bool operator!=(const Angle_Body& other) const {
9690 return _0 != other._0;
9691 }
9692 };
9693
9694 struct Time_Body {
9695 Tag tag;
9696 StyleTime _0;
9697
9698 bool operator==(const Time_Body& other) const {
9699 return _0 == other._0;
9700 }
9701 bool operator!=(const Time_Body& other) const {
9702 return _0 != other._0;
9703 }
9704 };
9705
9706 struct Resolution_Body {
9707 Tag tag;
9708 StyleResolution _0;
9709
9710 bool operator==(const Resolution_Body& other) const {
9711 return _0 == other._0;
9712 }
9713 bool operator!=(const Resolution_Body& other) const {
9714 return _0 != other._0;
9715 }
9716 };
9717
9718 struct ColorComponent_Body {
9719 Tag tag;
9720 StyleChannelKeyword _0;
9721
9722 bool operator==(const ColorComponent_Body& other) const {
9723 return _0 == other._0;
9724 }
9725 bool operator!=(const ColorComponent_Body& other) const {
9726 return _0 != other._0;
9727 }
9728 };
9729
9730 struct Percentage_Body {
9731 Tag tag;
9732 StyleCSSFloat _0;
9733
9734 bool operator==(const Percentage_Body& other) const {
9735 return _0 == other._0;
9736 }
9737 bool operator!=(const Percentage_Body& other) const {
9738 return _0 != other._0;
9739 }
9740 };
9741
9742 struct Number_Body {
9743 Tag tag;
9744 StyleCSSFloat _0;
9745
9746 bool operator==(const Number_Body& other) const {
9747 return _0 == other._0;
9748 }
9749 bool operator!=(const Number_Body& other) const {
9750 return _0 != other._0;
9751 }
9752 };
9753
9754 struct {
9755 Tag tag;
9756 };
9757 Length_Body length;
9758 Angle_Body angle;
9759 Time_Body time;
9760 Resolution_Body resolution;
9761 ColorComponent_Body color_component;
9762 Percentage_Body percentage;
9763 Number_Body number;
9764
9765 static StyleLeaf Length(const StyleNoCalcLength &_0) {
9766 StyleLeaf result;
9767 ::new (&result.length._0) (StyleNoCalcLength)(_0);
9768 result.tag = Tag::Length;
9769 return result;
9770 }
9771
9772 bool IsLength() const {
9773 return tag == Tag::Length;
9774 }
9775
9776 const StyleNoCalcLength& AsLength() const {
9777 MOZ_DIAGNOSTIC_ASSERT(IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLength()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9777); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLength()"
")"); do { *((volatile int*)__null) = 9777; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9778 return length._0;
9779 }
9780
9781 static StyleLeaf Angle(const StyleAngle &_0) {
9782 StyleLeaf result;
9783 ::new (&result.angle._0) (StyleAngle)(_0);
9784 result.tag = Tag::Angle;
9785 return result;
9786 }
9787
9788 bool IsAngle() const {
9789 return tag == Tag::Angle;
9790 }
9791
9792 const StyleAngle& AsAngle() const {
9793 MOZ_DIAGNOSTIC_ASSERT(IsAngle())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAngle())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAngle()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsAngle()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9793); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAngle()"
")"); do { *((volatile int*)__null) = 9793; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9794 return angle._0;
9795 }
9796
9797 static StyleLeaf Time(const StyleTime &_0) {
9798 StyleLeaf result;
9799 ::new (&result.time._0) (StyleTime)(_0);
9800 result.tag = Tag::Time;
9801 return result;
9802 }
9803
9804 bool IsTime() const {
9805 return tag == Tag::Time;
9806 }
9807
9808 const StyleTime& AsTime() const {
9809 MOZ_DIAGNOSTIC_ASSERT(IsTime())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTime())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTime()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsTime()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9809); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTime()"
")"); do { *((volatile int*)__null) = 9809; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9810 return time._0;
9811 }
9812
9813 static StyleLeaf Resolution(const StyleResolution &_0) {
9814 StyleLeaf result;
9815 ::new (&result.resolution._0) (StyleResolution)(_0);
9816 result.tag = Tag::Resolution;
9817 return result;
9818 }
9819
9820 bool IsResolution() const {
9821 return tag == Tag::Resolution;
9822 }
9823
9824 const StyleResolution& AsResolution() const {
9825 MOZ_DIAGNOSTIC_ASSERT(IsResolution())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsResolution())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsResolution()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsResolution()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9825); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsResolution()"
")"); do { *((volatile int*)__null) = 9825; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9826 return resolution._0;
9827 }
9828
9829 static StyleLeaf ColorComponent(const StyleChannelKeyword &_0) {
9830 StyleLeaf result;
9831 ::new (&result.color_component._0) (StyleChannelKeyword)(_0);
9832 result.tag = Tag::ColorComponent;
9833 return result;
9834 }
9835
9836 bool IsColorComponent() const {
9837 return tag == Tag::ColorComponent;
9838 }
9839
9840 const StyleChannelKeyword& AsColorComponent() const {
9841 MOZ_DIAGNOSTIC_ASSERT(IsColorComponent())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsColorComponent())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsColorComponent()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("IsColorComponent()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9841); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsColorComponent()"
")"); do { *((volatile int*)__null) = 9841; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9842 return color_component._0;
9843 }
9844
9845 static StyleLeaf Percentage(const StyleCSSFloat &_0) {
9846 StyleLeaf result;
9847 ::new (&result.percentage._0) (StyleCSSFloat)(_0);
9848 result.tag = Tag::Percentage;
9849 return result;
9850 }
9851
9852 bool IsPercentage() const {
9853 return tag == Tag::Percentage;
9854 }
9855
9856 const StyleCSSFloat& AsPercentage() const {
9857 MOZ_DIAGNOSTIC_ASSERT(IsPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPercentage()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9857); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPercentage()"
")"); do { *((volatile int*)__null) = 9857; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9858 return percentage._0;
9859 }
9860
9861 static StyleLeaf Number(const StyleCSSFloat &_0) {
9862 StyleLeaf result;
9863 ::new (&result.number._0) (StyleCSSFloat)(_0);
9864 result.tag = Tag::Number;
9865 return result;
9866 }
9867
9868 bool IsNumber() const {
9869 return tag == Tag::Number;
9870 }
9871
9872 const StyleCSSFloat& AsNumber() const {
9873 MOZ_DIAGNOSTIC_ASSERT(IsNumber())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsNumber())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsNumber()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsNumber()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9873); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsNumber()"
")"); do { *((volatile int*)__null) = 9873; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9874 return number._0;
9875 }
9876
9877 bool operator==(const StyleLeaf& other) const {
9878 if (tag != other.tag) {
9879 return false;
9880 }
9881 switch (tag) {
9882 case Tag::Length: return length == other.length;
9883 case Tag::Angle: return angle == other.angle;
9884 case Tag::Time: return time == other.time;
9885 case Tag::Resolution: return resolution == other.resolution;
9886 case Tag::ColorComponent: return color_component == other.color_component;
9887 case Tag::Percentage: return percentage == other.percentage;
9888 case Tag::Number: return number == other.number;
9889
9890 }
9891 return true;
9892 }
9893
9894 bool operator!=(const StyleLeaf& other) const {
9895 return !(*this == other);
9896 }
9897
9898 private:
9899 StyleLeaf() {
9900
9901 }
9902 public:
9903
9904
9905 ~StyleLeaf() {
9906 switch (tag) {
9907 case Tag::Length: length.~Length_Body(); break;
9908 case Tag::Angle: angle.~Angle_Body(); break;
9909 case Tag::Time: time.~Time_Body(); break;
9910 case Tag::Resolution: resolution.~Resolution_Body(); break;
9911 case Tag::ColorComponent: color_component.~ColorComponent_Body(); break;
9912 case Tag::Percentage: percentage.~Percentage_Body(); break;
9913 case Tag::Number: number.~Number_Body(); break;
9914
9915 }
9916 }
9917
9918 StyleLeaf(const StyleLeaf& other)
9919 : tag(other.tag) {
9920 switch (tag) {
9921 case Tag::Length: ::new (&length) (Length_Body)(other.length); break;
9922 case Tag::Angle: ::new (&angle) (Angle_Body)(other.angle); break;
9923 case Tag::Time: ::new (&time) (Time_Body)(other.time); break;
9924 case Tag::Resolution: ::new (&resolution) (Resolution_Body)(other.resolution); break;
9925 case Tag::ColorComponent: ::new (&color_component) (ColorComponent_Body)(other.color_component); break;
9926 case Tag::Percentage: ::new (&percentage) (Percentage_Body)(other.percentage); break;
9927 case Tag::Number: ::new (&number) (Number_Body)(other.number); break;
9928
9929 }
9930 }
9931 StyleLeaf& operator=(const StyleLeaf& other) {
9932 if (this != &other) {
9933 this->~StyleLeaf();
9934 new (this) StyleLeaf(other);
9935 }
9936 return *this;
9937 }
9938};
9939
9940/// <https://www.w3.org/TR/css-values-4/#dashed-idents>
9941/// This is simply an Atom, but will only parse if the identifier starts with "--".
9942using StyleDashedIdent = StyleAtom;
9943
9944/// Anchor side for the anchor positioning function.
9945template<typename P>
9946struct StyleAnchorSide {
9947 enum class Tag {
9948 /// A keyword value for the anchor side.
9949 Keyword,
9950 /// Percentage value between the `start` and `end` sides.
9951 Percentage,
9952 };
9953
9954 struct StyleKeyword_Body {
9955 StyleAnchorSideKeyword _0;
9956
9957 bool operator==(const StyleKeyword_Body& other) const {
9958 return _0 == other._0;
9959 }
9960 bool operator!=(const StyleKeyword_Body& other) const {
9961 return _0 != other._0;
9962 }
9963 };
9964
9965 struct StylePercentage_Body {
9966 P _0;
9967
9968 bool operator==(const StylePercentage_Body& other) const {
9969 return _0 == other._0;
9970 }
9971 bool operator!=(const StylePercentage_Body& other) const {
9972 return _0 != other._0;
9973 }
9974 };
9975
9976 Tag tag;
9977 union {
9978 StyleKeyword_Body keyword;
9979 StylePercentage_Body percentage;
9980 };
9981
9982 static StyleAnchorSide Keyword(const StyleAnchorSideKeyword &_0) {
9983 StyleAnchorSide result;
9984 ::new (&result.keyword._0) (StyleAnchorSideKeyword)(_0);
9985 result.tag = Tag::Keyword;
9986 return result;
9987 }
9988
9989 bool IsKeyword() const {
9990 return tag == Tag::Keyword;
9991 }
9992
9993 const StyleAnchorSideKeyword& AsKeyword() const {
9994 MOZ_DIAGNOSTIC_ASSERT(IsKeyword())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsKeyword())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsKeyword()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsKeyword()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 9994); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsKeyword()"
")"); do { *((volatile int*)__null) = 9994; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
9995 return keyword._0;
9996 }
9997
9998 static StyleAnchorSide Percentage(const P &_0) {
9999 StyleAnchorSide result;
10000 ::new (&result.percentage._0) (P)(_0);
10001 result.tag = Tag::Percentage;
10002 return result;
10003 }
10004
10005 bool IsPercentage() const {
10006 return tag == Tag::Percentage;
10007 }
10008
10009 const P& AsPercentage() const {
10010 MOZ_DIAGNOSTIC_ASSERT(IsPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPercentage()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10010); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPercentage()"
")"); do { *((volatile int*)__null) = 10010; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10011 return percentage._0;
10012 }
10013
10014 bool operator==(const StyleAnchorSide& other) const {
10015 if (tag != other.tag) {
10016 return false;
10017 }
10018 switch (tag) {
10019 case Tag::Keyword: return keyword == other.keyword;
10020 case Tag::Percentage: return percentage == other.percentage;
10021
10022 }
10023 return true;
10024 }
10025
10026 bool operator!=(const StyleAnchorSide& other) const {
10027 return !(*this == other);
10028 }
10029
10030 private:
10031 StyleAnchorSide() {
10032
10033 }
10034 public:
10035
10036
10037 ~StyleAnchorSide() {
10038 switch (tag) {
10039 case Tag::Keyword: keyword.~StyleKeyword_Body(); break;
10040 case Tag::Percentage: percentage.~StylePercentage_Body(); break;
10041
10042 }
10043 }
10044
10045 StyleAnchorSide(const StyleAnchorSide& other)
10046 : tag(other.tag) {
10047 switch (tag) {
10048 case Tag::Keyword: ::new (&keyword) (StyleKeyword_Body)(other.keyword); break;
10049 case Tag::Percentage: ::new (&percentage) (StylePercentage_Body)(other.percentage); break;
10050
10051 }
10052 }
10053 StyleAnchorSide& operator=(const StyleAnchorSide& other) {
10054 if (this != &other) {
10055 this->~StyleAnchorSide();
10056 new (this) StyleAnchorSide(other);
10057 }
10058 return *this;
10059 }
10060};
10061
10062/// Anchor function used by inset properties. This resolves
10063/// to length at computed time.
10064///
10065/// https://drafts.csswg.org/css-anchor-position-1/#funcdef-anchor
10066template<typename Percentage, typename LengthPercentage>
10067struct StyleGenericAnchorFunction {
10068 /// Anchor name of the element to anchor to.
10069 /// If omitted, selects the implicit anchor element.
10070 StyleDashedIdent target_element;
10071 /// Where relative to the target anchor element to position
10072 /// the anchored element to.
10073 StyleAnchorSide<Percentage> side;
10074 /// Value to use in case the anchor function is invalid.
10075 StyleOptional<LengthPercentage> fallback;
10076
10077 bool operator==(const StyleGenericAnchorFunction& other) const {
10078 return target_element == other.target_element &&
10079 side == other.side &&
10080 fallback == other.fallback;
10081 }
10082 bool operator!=(const StyleGenericAnchorFunction& other) const {
10083 return target_element != other.target_element ||
10084 side != other.side ||
10085 fallback != other.fallback;
10086 }
10087};
10088
10089/// Anchor size function used by sizing, margin and inset properties.
10090/// This resolves to the size of the anchor at computed time.
10091///
10092/// https://drafts.csswg.org/css-anchor-position-1/#funcdef-anchor-size
10093template<typename LengthPercentage>
10094struct StyleGenericAnchorSizeFunction {
10095 /// Anchor name of the element to anchor to.
10096 /// If omitted (i.e. empty), selects the implicit anchor element.
10097 StyleDashedIdent target_element;
10098 /// Size of the positioned element, expressed in that of the anchor element.
10099 /// If omitted, defaults to the axis of the property the function is used in.
10100 StyleAnchorSizeKeyword size;
10101 /// Value to use in case the anchor function is invalid.
10102 StyleOptional<LengthPercentage> fallback;
10103
10104 bool operator==(const StyleGenericAnchorSizeFunction& other) const {
10105 return target_element == other.target_element &&
10106 size == other.size &&
10107 fallback == other.fallback;
10108 }
10109 bool operator!=(const StyleGenericAnchorSizeFunction& other) const {
10110 return target_element != other.target_element ||
10111 size != other.size ||
10112 fallback != other.fallback;
10113 }
10114};
10115
10116/// A generic node in a calc expression.
10117///
10118/// FIXME: This would be much more elegant if we used `Self` in the types below,
10119/// but we can't because of https://github.com/serde-rs/serde/issues/1565.
10120///
10121/// FIXME: The following annotations are to workaround an LLVM inlining bug, see
10122/// bug 1631929.
10123///
10124template<typename L>
10125union StyleGenericCalcNode {
10126 enum class Tag : uint8_t {
10127 /// A leaf node.
10128 Leaf,
10129 /// A node that negates its child, e.g. Negate(1) == -1.
10130 Negate,
10131 /// A node that inverts its child, e.g. Invert(10) == 1 / 10 == 0.1. The child must always
10132 /// resolve to a number unit.
10133 Invert,
10134 /// A sum node, representing `a + b + c` where a, b, and c are the
10135 /// arguments.
10136 Sum,
10137 /// A product node, representing `a * b * c` where a, b, and c are the
10138 /// arguments.
10139 Product,
10140 /// A `min` or `max` function.
10141 MinMax,
10142 /// A `clamp()` function.
10143 Clamp,
10144 /// A `round()` function.
10145 Round,
10146 /// A `mod()` or `rem()` function.
10147 ModRem,
10148 /// A `hypot()` function
10149 Hypot,
10150 /// An `abs()` function.
10151 Abs,
10152 /// A `sign()` function.
10153 Sign,
10154 /// An `anchor()` function.
10155 Anchor,
10156 /// An `anchor-size()` function.
10157 AnchorSize,
10158 };
10159
10160 struct Leaf_Body {
10161 Tag tag;
10162 L _0;
10163
10164 bool operator==(const Leaf_Body& other) const {
10165 return _0 == other._0;
10166 }
10167 bool operator!=(const Leaf_Body& other) const {
10168 return _0 != other._0;
10169 }
10170 };
10171
10172 struct Negate_Body {
10173 Tag tag;
10174 StyleBox<StyleGenericCalcNode<L>> _0;
10175
10176 bool operator==(const Negate_Body& other) const {
10177 return _0 == other._0;
10178 }
10179 bool operator!=(const Negate_Body& other) const {
10180 return _0 != other._0;
10181 }
10182 };
10183
10184 struct Invert_Body {
10185 Tag tag;
10186 StyleBox<StyleGenericCalcNode<L>> _0;
10187
10188 bool operator==(const Invert_Body& other) const {
10189 return _0 == other._0;
10190 }
10191 bool operator!=(const Invert_Body& other) const {
10192 return _0 != other._0;
10193 }
10194 };
10195
10196 struct Sum_Body {
10197 Tag tag;
10198 StyleOwnedSlice<StyleGenericCalcNode<L>> _0;
10199
10200 bool operator==(const Sum_Body& other) const {
10201 return _0 == other._0;
10202 }
10203 bool operator!=(const Sum_Body& other) const {
10204 return _0 != other._0;
10205 }
10206 };
10207
10208 struct Product_Body {
10209 Tag tag;
10210 StyleOwnedSlice<StyleGenericCalcNode<L>> _0;
10211
10212 bool operator==(const Product_Body& other) const {
10213 return _0 == other._0;
10214 }
10215 bool operator!=(const Product_Body& other) const {
10216 return _0 != other._0;
10217 }
10218 };
10219
10220 struct MinMax_Body {
10221 Tag tag;
10222 StyleOwnedSlice<StyleGenericCalcNode<L>> _0;
10223 StyleMinMaxOp _1;
10224
10225 bool operator==(const MinMax_Body& other) const {
10226 return _0 == other._0 &&
10227 _1 == other._1;
10228 }
10229 bool operator!=(const MinMax_Body& other) const {
10230 return _0 != other._0 ||
10231 _1 != other._1;
10232 }
10233 };
10234
10235 struct Clamp_Body {
10236 Tag tag;
10237 /// The minimum value.
10238 StyleBox<StyleGenericCalcNode<L>> min;
10239 /// The central value.
10240 StyleBox<StyleGenericCalcNode<L>> center;
10241 /// The maximum value.
10242 StyleBox<StyleGenericCalcNode<L>> max;
10243
10244 bool operator==(const Clamp_Body& other) const {
10245 return min == other.min &&
10246 center == other.center &&
10247 max == other.max;
10248 }
10249 bool operator!=(const Clamp_Body& other) const {
10250 return min != other.min ||
10251 center != other.center ||
10252 max != other.max;
10253 }
10254 };
10255
10256 struct Round_Body {
10257 Tag tag;
10258 /// The rounding strategy.
10259 StyleRoundingStrategy strategy;
10260 /// The value to round.
10261 StyleBox<StyleGenericCalcNode<L>> value;
10262 /// The step value.
10263 StyleBox<StyleGenericCalcNode<L>> step;
10264
10265 bool operator==(const Round_Body& other) const {
10266 return strategy == other.strategy &&
10267 value == other.value &&
10268 step == other.step;
10269 }
10270 bool operator!=(const Round_Body& other) const {
10271 return strategy != other.strategy ||
10272 value != other.value ||
10273 step != other.step;
10274 }
10275 };
10276
10277 struct ModRem_Body {
10278 Tag tag;
10279 /// The dividend calculation.
10280 StyleBox<StyleGenericCalcNode<L>> dividend;
10281 /// The divisor calculation.
10282 StyleBox<StyleGenericCalcNode<L>> divisor;
10283 /// Is the function mod or rem?
10284 StyleModRemOp op;
10285
10286 bool operator==(const ModRem_Body& other) const {
10287 return dividend == other.dividend &&
10288 divisor == other.divisor &&
10289 op == other.op;
10290 }
10291 bool operator!=(const ModRem_Body& other) const {
10292 return dividend != other.dividend ||
10293 divisor != other.divisor ||
10294 op != other.op;
10295 }
10296 };
10297
10298 struct Hypot_Body {
10299 Tag tag;
10300 StyleOwnedSlice<StyleGenericCalcNode<L>> _0;
10301
10302 bool operator==(const Hypot_Body& other) const {
10303 return _0 == other._0;
10304 }
10305 bool operator!=(const Hypot_Body& other) const {
10306 return _0 != other._0;
10307 }
10308 };
10309
10310 struct Abs_Body {
10311 Tag tag;
10312 StyleBox<StyleGenericCalcNode<L>> _0;
10313
10314 bool operator==(const Abs_Body& other) const {
10315 return _0 == other._0;
10316 }
10317 bool operator!=(const Abs_Body& other) const {
10318 return _0 != other._0;
10319 }
10320 };
10321
10322 struct Sign_Body {
10323 Tag tag;
10324 StyleBox<StyleGenericCalcNode<L>> _0;
10325
10326 bool operator==(const Sign_Body& other) const {
10327 return _0 == other._0;
10328 }
10329 bool operator!=(const Sign_Body& other) const {
10330 return _0 != other._0;
10331 }
10332 };
10333
10334 struct Anchor_Body {
10335 Tag tag;
10336 StyleBox<StyleGenericAnchorFunction<StyleBox<StyleGenericCalcNode<L>>, StyleBox<StyleGenericCalcNode<L>>>> _0;
10337
10338 bool operator==(const Anchor_Body& other) const {
10339 return _0 == other._0;
10340 }
10341 bool operator!=(const Anchor_Body& other) const {
10342 return _0 != other._0;
10343 }
10344 };
10345
10346 struct AnchorSize_Body {
10347 Tag tag;
10348 StyleBox<StyleGenericAnchorSizeFunction<StyleBox<StyleGenericCalcNode<L>>>> _0;
10349
10350 bool operator==(const AnchorSize_Body& other) const {
10351 return _0 == other._0;
10352 }
10353 bool operator!=(const AnchorSize_Body& other) const {
10354 return _0 != other._0;
10355 }
10356 };
10357
10358 struct {
10359 Tag tag;
10360 };
10361 Leaf_Body leaf;
10362 Negate_Body negate;
10363 Invert_Body invert;
10364 Sum_Body sum;
10365 Product_Body product;
10366 MinMax_Body min_max;
10367 Clamp_Body clamp;
10368 Round_Body round;
10369 ModRem_Body mod_rem;
10370 Hypot_Body hypot;
10371 Abs_Body abs;
10372 Sign_Body sign;
10373 Anchor_Body anchor;
10374 AnchorSize_Body anchor_size;
10375
10376 static StyleGenericCalcNode Leaf(const L &_0) {
10377 StyleGenericCalcNode result;
10378 ::new (&result.leaf._0) (L)(_0);
10379 result.tag = Tag::Leaf;
10380 return result;
10381 }
10382
10383 bool IsLeaf() const {
10384 return tag == Tag::Leaf;
10385 }
10386
10387 const L& AsLeaf() const {
10388 MOZ_DIAGNOSTIC_ASSERT(IsLeaf())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLeaf())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLeaf()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLeaf()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10388); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLeaf()"
")"); do { *((volatile int*)__null) = 10388; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10389 return leaf._0;
10390 }
10391
10392 static StyleGenericCalcNode Negate(const StyleBox<StyleGenericCalcNode<L>> &_0) {
10393 StyleGenericCalcNode result;
10394 ::new (&result.negate._0) (StyleBox<StyleGenericCalcNode<L>>)(_0);
10395 result.tag = Tag::Negate;
10396 return result;
10397 }
10398
10399 bool IsNegate() const {
10400 return tag == Tag::Negate;
10401 }
10402
10403 const StyleBox<StyleGenericCalcNode<L>>& AsNegate() const {
10404 MOZ_DIAGNOSTIC_ASSERT(IsNegate())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsNegate())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsNegate()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsNegate()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10404); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsNegate()"
")"); do { *((volatile int*)__null) = 10404; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10405 return negate._0;
10406 }
10407
10408 static StyleGenericCalcNode Invert(const StyleBox<StyleGenericCalcNode<L>> &_0) {
10409 StyleGenericCalcNode result;
10410 ::new (&result.invert._0) (StyleBox<StyleGenericCalcNode<L>>)(_0);
10411 result.tag = Tag::Invert;
10412 return result;
10413 }
10414
10415 bool IsInvert() const {
10416 return tag == Tag::Invert;
10417 }
10418
10419 const StyleBox<StyleGenericCalcNode<L>>& AsInvert() const {
10420 MOZ_DIAGNOSTIC_ASSERT(IsInvert())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsInvert())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsInvert()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsInvert()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10420); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsInvert()"
")"); do { *((volatile int*)__null) = 10420; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10421 return invert._0;
10422 }
10423
10424 static StyleGenericCalcNode Sum(const StyleOwnedSlice<StyleGenericCalcNode<L>> &_0) {
10425 StyleGenericCalcNode result;
10426 ::new (&result.sum._0) (StyleOwnedSlice<StyleGenericCalcNode<L>>)(_0);
10427 result.tag = Tag::Sum;
10428 return result;
10429 }
10430
10431 bool IsSum() const {
10432 return tag == Tag::Sum;
10433 }
10434
10435 const StyleOwnedSlice<StyleGenericCalcNode<L>>& AsSum() const {
10436 MOZ_DIAGNOSTIC_ASSERT(IsSum())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSum())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSum()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSum()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10436); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSum()"
")"); do { *((volatile int*)__null) = 10436; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10437 return sum._0;
10438 }
10439
10440 static StyleGenericCalcNode Product(const StyleOwnedSlice<StyleGenericCalcNode<L>> &_0) {
10441 StyleGenericCalcNode result;
10442 ::new (&result.product._0) (StyleOwnedSlice<StyleGenericCalcNode<L>>)(_0);
10443 result.tag = Tag::Product;
10444 return result;
10445 }
10446
10447 bool IsProduct() const {
10448 return tag == Tag::Product;
10449 }
10450
10451 const StyleOwnedSlice<StyleGenericCalcNode<L>>& AsProduct() const {
10452 MOZ_DIAGNOSTIC_ASSERT(IsProduct())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsProduct())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsProduct()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsProduct()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10452); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsProduct()"
")"); do { *((volatile int*)__null) = 10452; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10453 return product._0;
10454 }
10455
10456 static StyleGenericCalcNode MinMax(const StyleOwnedSlice<StyleGenericCalcNode<L>> &_0,
10457 const StyleMinMaxOp &_1) {
10458 StyleGenericCalcNode result;
10459 ::new (&result.min_max._0) (StyleOwnedSlice<StyleGenericCalcNode<L>>)(_0);
10460 ::new (&result.min_max._1) (StyleMinMaxOp)(_1);
10461 result.tag = Tag::MinMax;
10462 return result;
10463 }
10464
10465 bool IsMinMax() const {
10466 return tag == Tag::MinMax;
10467 }
10468
10469 const MinMax_Body& AsMinMax() const {
10470 MOZ_DIAGNOSTIC_ASSERT(IsMinMax())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsMinMax())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsMinMax()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsMinMax()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10470); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsMinMax()"
")"); do { *((volatile int*)__null) = 10470; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10471 return min_max;
10472 }
10473
10474 static StyleGenericCalcNode Clamp(const StyleBox<StyleGenericCalcNode<L>> &min,
10475 const StyleBox<StyleGenericCalcNode<L>> &center,
10476 const StyleBox<StyleGenericCalcNode<L>> &max) {
10477 StyleGenericCalcNode result;
10478 ::new (&result.clamp.min) (StyleBox<StyleGenericCalcNode<L>>)(min);
10479 ::new (&result.clamp.center) (StyleBox<StyleGenericCalcNode<L>>)(center);
10480 ::new (&result.clamp.max) (StyleBox<StyleGenericCalcNode<L>>)(max);
10481 result.tag = Tag::Clamp;
10482 return result;
10483 }
10484
10485 bool IsClamp() const {
10486 return tag == Tag::Clamp;
10487 }
10488
10489 const Clamp_Body& AsClamp() const {
10490 MOZ_DIAGNOSTIC_ASSERT(IsClamp())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsClamp())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsClamp()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsClamp()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10490); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsClamp()"
")"); do { *((volatile int*)__null) = 10490; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10491 return clamp;
10492 }
10493
10494 static StyleGenericCalcNode Round(const StyleRoundingStrategy &strategy,
10495 const StyleBox<StyleGenericCalcNode<L>> &value,
10496 const StyleBox<StyleGenericCalcNode<L>> &step) {
10497 StyleGenericCalcNode result;
10498 ::new (&result.round.strategy) (StyleRoundingStrategy)(strategy);
10499 ::new (&result.round.value) (StyleBox<StyleGenericCalcNode<L>>)(value);
10500 ::new (&result.round.step) (StyleBox<StyleGenericCalcNode<L>>)(step);
10501 result.tag = Tag::Round;
10502 return result;
10503 }
10504
10505 bool IsRound() const {
10506 return tag == Tag::Round;
10507 }
10508
10509 const Round_Body& AsRound() const {
10510 MOZ_DIAGNOSTIC_ASSERT(IsRound())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRound())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRound()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsRound()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10510); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRound()"
")"); do { *((volatile int*)__null) = 10510; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10511 return round;
10512 }
10513
10514 static StyleGenericCalcNode ModRem(const StyleBox<StyleGenericCalcNode<L>> &dividend,
10515 const StyleBox<StyleGenericCalcNode<L>> &divisor,
10516 const StyleModRemOp &op) {
10517 StyleGenericCalcNode result;
10518 ::new (&result.mod_rem.dividend) (StyleBox<StyleGenericCalcNode<L>>)(dividend);
10519 ::new (&result.mod_rem.divisor) (StyleBox<StyleGenericCalcNode<L>>)(divisor);
10520 ::new (&result.mod_rem.op) (StyleModRemOp)(op);
10521 result.tag = Tag::ModRem;
10522 return result;
10523 }
10524
10525 bool IsModRem() const {
10526 return tag == Tag::ModRem;
10527 }
10528
10529 const ModRem_Body& AsModRem() const {
10530 MOZ_DIAGNOSTIC_ASSERT(IsModRem())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsModRem())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsModRem()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsModRem()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10530); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsModRem()"
")"); do { *((volatile int*)__null) = 10530; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10531 return mod_rem;
10532 }
10533
10534 static StyleGenericCalcNode Hypot(const StyleOwnedSlice<StyleGenericCalcNode<L>> &_0) {
10535 StyleGenericCalcNode result;
10536 ::new (&result.hypot._0) (StyleOwnedSlice<StyleGenericCalcNode<L>>)(_0);
10537 result.tag = Tag::Hypot;
10538 return result;
10539 }
10540
10541 bool IsHypot() const {
10542 return tag == Tag::Hypot;
10543 }
10544
10545 const StyleOwnedSlice<StyleGenericCalcNode<L>>& AsHypot() const {
10546 MOZ_DIAGNOSTIC_ASSERT(IsHypot())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsHypot())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsHypot()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsHypot()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10546); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsHypot()"
")"); do { *((volatile int*)__null) = 10546; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10547 return hypot._0;
10548 }
10549
10550 static StyleGenericCalcNode Abs(const StyleBox<StyleGenericCalcNode<L>> &_0) {
10551 StyleGenericCalcNode result;
10552 ::new (&result.abs._0) (StyleBox<StyleGenericCalcNode<L>>)(_0);
10553 result.tag = Tag::Abs;
10554 return result;
10555 }
10556
10557 bool IsAbs() const {
10558 return tag == Tag::Abs;
10559 }
10560
10561 const StyleBox<StyleGenericCalcNode<L>>& AsAbs() const {
10562 MOZ_DIAGNOSTIC_ASSERT(IsAbs())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAbs())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAbs()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsAbs()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10562); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAbs()"
")"); do { *((volatile int*)__null) = 10562; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10563 return abs._0;
10564 }
10565
10566 static StyleGenericCalcNode Sign(const StyleBox<StyleGenericCalcNode<L>> &_0) {
10567 StyleGenericCalcNode result;
10568 ::new (&result.sign._0) (StyleBox<StyleGenericCalcNode<L>>)(_0);
10569 result.tag = Tag::Sign;
10570 return result;
10571 }
10572
10573 bool IsSign() const {
10574 return tag == Tag::Sign;
10575 }
10576
10577 const StyleBox<StyleGenericCalcNode<L>>& AsSign() const {
10578 MOZ_DIAGNOSTIC_ASSERT(IsSign())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSign())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSign()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSign()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10578); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSign()"
")"); do { *((volatile int*)__null) = 10578; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10579 return sign._0;
10580 }
10581
10582 static StyleGenericCalcNode Anchor(const StyleBox<StyleGenericAnchorFunction<StyleBox<StyleGenericCalcNode<L>>, StyleBox<StyleGenericCalcNode<L>>>> &_0) {
10583 StyleGenericCalcNode result;
10584 ::new (&result.anchor._0) (StyleBox<StyleGenericAnchorFunction<StyleBox<StyleGenericCalcNode<L>>, StyleBox<StyleGenericCalcNode<L>>>>)(_0);
10585 result.tag = Tag::Anchor;
10586 return result;
10587 }
10588
10589 bool IsAnchor() const {
10590 return tag == Tag::Anchor;
10591 }
10592
10593 const StyleBox<StyleGenericAnchorFunction<StyleBox<StyleGenericCalcNode<L>>, StyleBox<StyleGenericCalcNode<L>>>>& AsAnchor() const {
10594 MOZ_DIAGNOSTIC_ASSERT(IsAnchor())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAnchor())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAnchor()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsAnchor()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10594); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAnchor()"
")"); do { *((volatile int*)__null) = 10594; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10595 return anchor._0;
10596 }
10597
10598 static StyleGenericCalcNode AnchorSize(const StyleBox<StyleGenericAnchorSizeFunction<StyleBox<StyleGenericCalcNode<L>>>> &_0) {
10599 StyleGenericCalcNode result;
10600 ::new (&result.anchor_size._0) (StyleBox<StyleGenericAnchorSizeFunction<StyleBox<StyleGenericCalcNode<L>>>>)(_0);
10601 result.tag = Tag::AnchorSize;
10602 return result;
10603 }
10604
10605 bool IsAnchorSize() const {
10606 return tag == Tag::AnchorSize;
10607 }
10608
10609 const StyleBox<StyleGenericAnchorSizeFunction<StyleBox<StyleGenericCalcNode<L>>>>& AsAnchorSize() const {
10610 MOZ_DIAGNOSTIC_ASSERT(IsAnchorSize())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAnchorSize())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAnchorSize()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsAnchorSize()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10610); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAnchorSize()"
")"); do { *((volatile int*)__null) = 10610; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10611 return anchor_size._0;
10612 }
10613
10614 MOZ_NEVER_INLINE__attribute__((noinline)) bool operator==(const StyleGenericCalcNode& other) const {
10615 if (tag != other.tag) {
10616 return false;
10617 }
10618 switch (tag) {
10619 case Tag::Leaf: return leaf == other.leaf;
10620 case Tag::Negate: return negate == other.negate;
10621 case Tag::Invert: return invert == other.invert;
10622 case Tag::Sum: return sum == other.sum;
10623 case Tag::Product: return product == other.product;
10624 case Tag::MinMax: return min_max == other.min_max;
10625 case Tag::Clamp: return clamp == other.clamp;
10626 case Tag::Round: return round == other.round;
10627 case Tag::ModRem: return mod_rem == other.mod_rem;
10628 case Tag::Hypot: return hypot == other.hypot;
10629 case Tag::Abs: return abs == other.abs;
10630 case Tag::Sign: return sign == other.sign;
10631 case Tag::Anchor: return anchor == other.anchor;
10632 case Tag::AnchorSize: return anchor_size == other.anchor_size;
10633
10634 }
10635 return true;
10636 }
10637
10638 bool operator!=(const StyleGenericCalcNode& other) const {
10639 return !(*this == other);
10640 }
10641
10642 private:
10643 StyleGenericCalcNode() {
10644
10645 }
10646 public:
10647
10648
10649 MOZ_NEVER_INLINE__attribute__((noinline)) ~StyleGenericCalcNode() {
10650 switch (tag) {
7
Control jumps to 'case Sign:' at line 10662
14
Control jumps to 'case AnchorSize:' at line 10664
10651 case Tag::Leaf: leaf.~Leaf_Body(); break;
10652 case Tag::Negate: negate.~Negate_Body(); break;
10653 case Tag::Invert: invert.~Invert_Body(); break;
10654 case Tag::Sum: sum.~Sum_Body(); break;
10655 case Tag::Product: product.~Product_Body(); break;
10656 case Tag::MinMax: min_max.~MinMax_Body(); break;
10657 case Tag::Clamp: clamp.~Clamp_Body(); break;
10658 case Tag::Round: round.~Round_Body(); break;
10659 case Tag::ModRem: mod_rem.~ModRem_Body(); break;
10660 case Tag::Hypot: hypot.~Hypot_Body(); break;
10661 case Tag::Abs: abs.~Abs_Body(); break;
10662 case Tag::Sign: sign.~Sign_Body(); break;
8
Calling implicit destructor for 'Sign_Body'
9
Calling '~StyleBox'
10663 case Tag::Anchor: anchor.~Anchor_Body(); break;
10664 case Tag::AnchorSize: anchor_size.~AnchorSize_Body(); break;
15
Calling implicit destructor for 'AnchorSize_Body'
16
Calling '~StyleBox'
23
Returning from '~StyleBox'
24
Returning; memory was released
25
Execution continues on line 144
10665
10666 }
10667 }
26
Calling implicit destructor for 'AnchorSize_Body'
27
Calling '~StyleBox'
10668
10669 MOZ_NEVER_INLINE__attribute__((noinline)) StyleGenericCalcNode(const StyleGenericCalcNode& other)
10670 : tag(other.tag) {
10671 switch (tag) {
10672 case Tag::Leaf: ::new (&leaf) (Leaf_Body)(other.leaf); break;
10673 case Tag::Negate: ::new (&negate) (Negate_Body)(other.negate); break;
10674 case Tag::Invert: ::new (&invert) (Invert_Body)(other.invert); break;
10675 case Tag::Sum: ::new (&sum) (Sum_Body)(other.sum); break;
10676 case Tag::Product: ::new (&product) (Product_Body)(other.product); break;
10677 case Tag::MinMax: ::new (&min_max) (MinMax_Body)(other.min_max); break;
10678 case Tag::Clamp: ::new (&clamp) (Clamp_Body)(other.clamp); break;
10679 case Tag::Round: ::new (&round) (Round_Body)(other.round); break;
10680 case Tag::ModRem: ::new (&mod_rem) (ModRem_Body)(other.mod_rem); break;
10681 case Tag::Hypot: ::new (&hypot) (Hypot_Body)(other.hypot); break;
10682 case Tag::Abs: ::new (&abs) (Abs_Body)(other.abs); break;
10683 case Tag::Sign: ::new (&sign) (Sign_Body)(other.sign); break;
10684 case Tag::Anchor: ::new (&anchor) (Anchor_Body)(other.anchor); break;
10685 case Tag::AnchorSize: ::new (&anchor_size) (AnchorSize_Body)(other.anchor_size); break;
10686
10687 }
10688 }
10689 StyleGenericCalcNode& operator=(const StyleGenericCalcNode& other) {
10690 if (this != &other) {
10691 this->~StyleGenericCalcNode();
10692 new (this) StyleGenericCalcNode(other);
10693 }
10694 return *this;
10695 }
10696 void ScaleLengthsBy(float);
10697};
10698
10699/// A single color component.
10700template<typename ValueType>
10701union StyleColorComponent {
10702 enum class Tag : uint8_t {
10703 /// The "none" keyword.
10704 None,
10705 /// A absolute value.
10706 Value,
10707 /// A channel keyword, e.g. `r`, `l`, `alpha`, etc.
10708 ChannelKeyword,
10709 /// A calc() value.
10710 Calc,
10711 /// Used when alpha components are not specified.
10712 AlphaOmitted,
10713 };
10714
10715 struct Value_Body {
10716 Tag tag;
10717 ValueType _0;
10718
10719 bool operator==(const Value_Body& other) const {
10720 return _0 == other._0;
10721 }
10722 bool operator!=(const Value_Body& other) const {
10723 return _0 != other._0;
10724 }
10725 };
10726
10727 struct ChannelKeyword_Body {
10728 Tag tag;
10729 StyleChannelKeyword _0;
10730
10731 bool operator==(const ChannelKeyword_Body& other) const {
10732 return _0 == other._0;
10733 }
10734 bool operator!=(const ChannelKeyword_Body& other) const {
10735 return _0 != other._0;
10736 }
10737 };
10738
10739 struct Calc_Body {
10740 Tag tag;
10741 StyleBox<StyleGenericCalcNode<StyleLeaf>> _0;
10742
10743 bool operator==(const Calc_Body& other) const {
10744 return _0 == other._0;
10745 }
10746 bool operator!=(const Calc_Body& other) const {
10747 return _0 != other._0;
10748 }
10749 };
10750
10751 struct {
10752 Tag tag;
10753 };
10754 Value_Body value;
10755 ChannelKeyword_Body channel_keyword;
10756 Calc_Body calc;
10757
10758 static StyleColorComponent None() {
10759 StyleColorComponent result;
10760 result.tag = Tag::None;
10761 return result;
10762 }
10763
10764 bool IsNone() const {
10765 return tag == Tag::None;
10766 }
10767
10768 static StyleColorComponent Value(const ValueType &_0) {
10769 StyleColorComponent result;
10770 ::new (&result.value._0) (ValueType)(_0);
10771 result.tag = Tag::Value;
10772 return result;
10773 }
10774
10775 bool IsValue() const {
10776 return tag == Tag::Value;
10777 }
10778
10779 const ValueType& AsValue() const {
10780 MOZ_DIAGNOSTIC_ASSERT(IsValue())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsValue())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsValue()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsValue()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10780); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsValue()"
")"); do { *((volatile int*)__null) = 10780; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10781 return value._0;
10782 }
10783
10784 static StyleColorComponent ChannelKeyword(const StyleChannelKeyword &_0) {
10785 StyleColorComponent result;
10786 ::new (&result.channel_keyword._0) (StyleChannelKeyword)(_0);
10787 result.tag = Tag::ChannelKeyword;
10788 return result;
10789 }
10790
10791 bool IsChannelKeyword() const {
10792 return tag == Tag::ChannelKeyword;
10793 }
10794
10795 const StyleChannelKeyword& AsChannelKeyword() const {
10796 MOZ_DIAGNOSTIC_ASSERT(IsChannelKeyword())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsChannelKeyword())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsChannelKeyword()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("IsChannelKeyword()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10796); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsChannelKeyword()"
")"); do { *((volatile int*)__null) = 10796; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10797 return channel_keyword._0;
10798 }
10799
10800 static StyleColorComponent Calc(const StyleBox<StyleGenericCalcNode<StyleLeaf>> &_0) {
10801 StyleColorComponent result;
10802 ::new (&result.calc._0) (StyleBox<StyleGenericCalcNode<StyleLeaf>>)(_0);
10803 result.tag = Tag::Calc;
10804 return result;
10805 }
10806
10807 bool IsCalc() const {
10808 return tag == Tag::Calc;
10809 }
10810
10811 const StyleBox<StyleGenericCalcNode<StyleLeaf>>& AsCalc() const {
10812 MOZ_DIAGNOSTIC_ASSERT(IsCalc())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCalc())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCalc()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsCalc()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10812); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCalc()"
")"); do { *((volatile int*)__null) = 10812; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10813 return calc._0;
10814 }
10815
10816 static StyleColorComponent AlphaOmitted() {
10817 StyleColorComponent result;
10818 result.tag = Tag::AlphaOmitted;
10819 return result;
10820 }
10821
10822 bool IsAlphaOmitted() const {
10823 return tag == Tag::AlphaOmitted;
10824 }
10825
10826 bool operator==(const StyleColorComponent& other) const {
10827 if (tag != other.tag) {
10828 return false;
10829 }
10830 switch (tag) {
10831 case Tag::Value: return value == other.value;
10832 case Tag::ChannelKeyword: return channel_keyword == other.channel_keyword;
10833 case Tag::Calc: return calc == other.calc;
10834 default: break;
10835 }
10836 return true;
10837 }
10838
10839 bool operator!=(const StyleColorComponent& other) const {
10840 return !(*this == other);
10841 }
10842
10843 private:
10844 StyleColorComponent() {
10845
10846 }
10847 public:
10848
10849
10850 ~StyleColorComponent() {
10851 switch (tag) {
10852 case Tag::Value: value.~Value_Body(); break;
10853 case Tag::ChannelKeyword: channel_keyword.~ChannelKeyword_Body(); break;
10854 case Tag::Calc: calc.~Calc_Body(); break;
10855 default: break;
10856 }
10857 }
10858
10859 StyleColorComponent(const StyleColorComponent& other)
10860 : tag(other.tag) {
10861 switch (tag) {
10862 case Tag::Value: ::new (&value) (Value_Body)(other.value); break;
10863 case Tag::ChannelKeyword: ::new (&channel_keyword) (ChannelKeyword_Body)(other.channel_keyword); break;
10864 case Tag::Calc: ::new (&calc) (Calc_Body)(other.calc); break;
10865 default: break;
10866 }
10867 }
10868 StyleColorComponent& operator=(const StyleColorComponent& other) {
10869 if (this != &other) {
10870 this->~StyleColorComponent();
10871 new (this) StyleColorComponent(other);
10872 }
10873 return *this;
10874 }
10875};
10876
10877/// Either an angle or a number.
10878union StyleNumberOrAngleComponent {
10879 enum class Tag : uint8_t {
10880 /// `<number>`.
10881 Number,
10882 /// `<angle>`
10883 /// The value as a number of degrees.
10884 Angle,
10885 };
10886
10887 struct Number_Body {
10888 Tag tag;
10889 float _0;
10890
10891 bool operator==(const Number_Body& other) const {
10892 return _0 == other._0;
10893 }
10894 bool operator!=(const Number_Body& other) const {
10895 return _0 != other._0;
10896 }
10897 };
10898
10899 struct Angle_Body {
10900 Tag tag;
10901 float _0;
10902
10903 bool operator==(const Angle_Body& other) const {
10904 return _0 == other._0;
10905 }
10906 bool operator!=(const Angle_Body& other) const {
10907 return _0 != other._0;
10908 }
10909 };
10910
10911 struct {
10912 Tag tag;
10913 };
10914 Number_Body number;
10915 Angle_Body angle;
10916
10917 static StyleNumberOrAngleComponent Number(const float &_0) {
10918 StyleNumberOrAngleComponent result;
10919 ::new (&result.number._0) (float)(_0);
10920 result.tag = Tag::Number;
10921 return result;
10922 }
10923
10924 bool IsNumber() const {
10925 return tag == Tag::Number;
10926 }
10927
10928 const float& AsNumber() const {
10929 MOZ_DIAGNOSTIC_ASSERT(IsNumber())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsNumber())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsNumber()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsNumber()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10929); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsNumber()"
")"); do { *((volatile int*)__null) = 10929; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10930 return number._0;
10931 }
10932
10933 static StyleNumberOrAngleComponent Angle(const float &_0) {
10934 StyleNumberOrAngleComponent result;
10935 ::new (&result.angle._0) (float)(_0);
10936 result.tag = Tag::Angle;
10937 return result;
10938 }
10939
10940 bool IsAngle() const {
10941 return tag == Tag::Angle;
10942 }
10943
10944 const float& AsAngle() const {
10945 MOZ_DIAGNOSTIC_ASSERT(IsAngle())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAngle())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAngle()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsAngle()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 10945); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAngle()"
")"); do { *((volatile int*)__null) = 10945; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
10946 return angle._0;
10947 }
10948
10949 bool operator==(const StyleNumberOrAngleComponent& other) const {
10950 if (tag != other.tag) {
10951 return false;
10952 }
10953 switch (tag) {
10954 case Tag::Number: return number == other.number;
10955 case Tag::Angle: return angle == other.angle;
10956
10957 }
10958 return true;
10959 }
10960
10961 bool operator!=(const StyleNumberOrAngleComponent& other) const {
10962 return !(*this == other);
10963 }
10964
10965 private:
10966 StyleNumberOrAngleComponent() {
10967
10968 }
10969 public:
10970
10971
10972 ~StyleNumberOrAngleComponent() {
10973 switch (tag) {
10974 case Tag::Number: number.~Number_Body(); break;
10975 case Tag::Angle: angle.~Angle_Body(); break;
10976
10977 }
10978 }
10979
10980 StyleNumberOrAngleComponent(const StyleNumberOrAngleComponent& other)
10981 : tag(other.tag) {
10982 switch (tag) {
10983 case Tag::Number: ::new (&number) (Number_Body)(other.number); break;
10984 case Tag::Angle: ::new (&angle) (Angle_Body)(other.angle); break;
10985
10986 }
10987 }
10988 StyleNumberOrAngleComponent& operator=(const StyleNumberOrAngleComponent& other) {
10989 if (this != &other) {
10990 this->~StyleNumberOrAngleComponent();
10991 new (this) StyleNumberOrAngleComponent(other);
10992 }
10993 return *this;
10994 }
10995};
10996
10997/// Represents a specified color function.
10998template<typename OriginColor>
10999union StyleColorFunction {
11000 enum class Tag : uint8_t {
11001 /// <https://drafts.csswg.org/css-color-4/#rgb-functions>
11002 Rgb,
11003 /// <https://drafts.csswg.org/css-color-4/#the-hsl-notation>
11004 Hsl,
11005 /// <https://drafts.csswg.org/css-color-4/#the-hwb-notation>
11006 Hwb,
11007 /// <https://drafts.csswg.org/css-color-4/#specifying-lab-lch>
11008 Lab,
11009 /// <https://drafts.csswg.org/css-color-4/#specifying-lab-lch>
11010 Lch,
11011 /// <https://drafts.csswg.org/css-color-4/#specifying-oklab-oklch>
11012 Oklab,
11013 /// <https://drafts.csswg.org/css-color-4/#specifying-oklab-oklch>
11014 Oklch,
11015 /// <https://drafts.csswg.org/css-color-4/#color-function>
11016 Color,
11017 };
11018
11019 struct Rgb_Body {
11020 Tag tag;
11021 StyleOptional<OriginColor> _0;
11022 StyleColorComponent<StyleNumberOrPercentageComponent> _1;
11023 StyleColorComponent<StyleNumberOrPercentageComponent> _2;
11024 StyleColorComponent<StyleNumberOrPercentageComponent> _3;
11025 StyleColorComponent<StyleNumberOrPercentageComponent> _4;
11026
11027 bool operator==(const Rgb_Body& other) const {
11028 return _0 == other._0 &&
11029 _1 == other._1 &&
11030 _2 == other._2 &&
11031 _3 == other._3 &&
11032 _4 == other._4;
11033 }
11034 bool operator!=(const Rgb_Body& other) const {
11035 return _0 != other._0 ||
11036 _1 != other._1 ||
11037 _2 != other._2 ||
11038 _3 != other._3 ||
11039 _4 != other._4;
11040 }
11041 };
11042
11043 struct Hsl_Body {
11044 Tag tag;
11045 StyleOptional<OriginColor> _0;
11046 StyleColorComponent<StyleNumberOrAngleComponent> _1;
11047 StyleColorComponent<StyleNumberOrPercentageComponent> _2;
11048 StyleColorComponent<StyleNumberOrPercentageComponent> _3;
11049 StyleColorComponent<StyleNumberOrPercentageComponent> _4;
11050
11051 bool operator==(const Hsl_Body& other) const {
11052 return _0 == other._0 &&
11053 _1 == other._1 &&
11054 _2 == other._2 &&
11055 _3 == other._3 &&
11056 _4 == other._4;
11057 }
11058 bool operator!=(const Hsl_Body& other) const {
11059 return _0 != other._0 ||
11060 _1 != other._1 ||
11061 _2 != other._2 ||
11062 _3 != other._3 ||
11063 _4 != other._4;
11064 }
11065 };
11066
11067 struct Hwb_Body {
11068 Tag tag;
11069 StyleOptional<OriginColor> _0;
11070 StyleColorComponent<StyleNumberOrAngleComponent> _1;
11071 StyleColorComponent<StyleNumberOrPercentageComponent> _2;
11072 StyleColorComponent<StyleNumberOrPercentageComponent> _3;
11073 StyleColorComponent<StyleNumberOrPercentageComponent> _4;
11074
11075 bool operator==(const Hwb_Body& other) const {
11076 return _0 == other._0 &&
11077 _1 == other._1 &&
11078 _2 == other._2 &&
11079 _3 == other._3 &&
11080 _4 == other._4;
11081 }
11082 bool operator!=(const Hwb_Body& other) const {
11083 return _0 != other._0 ||
11084 _1 != other._1 ||
11085 _2 != other._2 ||
11086 _3 != other._3 ||
11087 _4 != other._4;
11088 }
11089 };
11090
11091 struct Lab_Body {
11092 Tag tag;
11093 StyleOptional<OriginColor> _0;
11094 StyleColorComponent<StyleNumberOrPercentageComponent> _1;
11095 StyleColorComponent<StyleNumberOrPercentageComponent> _2;
11096 StyleColorComponent<StyleNumberOrPercentageComponent> _3;
11097 StyleColorComponent<StyleNumberOrPercentageComponent> _4;
11098
11099 bool operator==(const Lab_Body& other) const {
11100 return _0 == other._0 &&
11101 _1 == other._1 &&
11102 _2 == other._2 &&
11103 _3 == other._3 &&
11104 _4 == other._4;
11105 }
11106 bool operator!=(const Lab_Body& other) const {
11107 return _0 != other._0 ||
11108 _1 != other._1 ||
11109 _2 != other._2 ||
11110 _3 != other._3 ||
11111 _4 != other._4;
11112 }
11113 };
11114
11115 struct Lch_Body {
11116 Tag tag;
11117 StyleOptional<OriginColor> _0;
11118 StyleColorComponent<StyleNumberOrPercentageComponent> _1;
11119 StyleColorComponent<StyleNumberOrPercentageComponent> _2;
11120 StyleColorComponent<StyleNumberOrAngleComponent> _3;
11121 StyleColorComponent<StyleNumberOrPercentageComponent> _4;
11122
11123 bool operator==(const Lch_Body& other) const {
11124 return _0 == other._0 &&
11125 _1 == other._1 &&
11126 _2 == other._2 &&
11127 _3 == other._3 &&
11128 _4 == other._4;
11129 }
11130 bool operator!=(const Lch_Body& other) const {
11131 return _0 != other._0 ||
11132 _1 != other._1 ||
11133 _2 != other._2 ||
11134 _3 != other._3 ||
11135 _4 != other._4;
11136 }
11137 };
11138
11139 struct Oklab_Body {
11140 Tag tag;
11141 StyleOptional<OriginColor> _0;
11142 StyleColorComponent<StyleNumberOrPercentageComponent> _1;
11143 StyleColorComponent<StyleNumberOrPercentageComponent> _2;
11144 StyleColorComponent<StyleNumberOrPercentageComponent> _3;
11145 StyleColorComponent<StyleNumberOrPercentageComponent> _4;
11146
11147 bool operator==(const Oklab_Body& other) const {
11148 return _0 == other._0 &&
11149 _1 == other._1 &&
11150 _2 == other._2 &&
11151 _3 == other._3 &&
11152 _4 == other._4;
11153 }
11154 bool operator!=(const Oklab_Body& other) const {
11155 return _0 != other._0 ||
11156 _1 != other._1 ||
11157 _2 != other._2 ||
11158 _3 != other._3 ||
11159 _4 != other._4;
11160 }
11161 };
11162
11163 struct Oklch_Body {
11164 Tag tag;
11165 StyleOptional<OriginColor> _0;
11166 StyleColorComponent<StyleNumberOrPercentageComponent> _1;
11167 StyleColorComponent<StyleNumberOrPercentageComponent> _2;
11168 StyleColorComponent<StyleNumberOrAngleComponent> _3;
11169 StyleColorComponent<StyleNumberOrPercentageComponent> _4;
11170
11171 bool operator==(const Oklch_Body& other) const {
11172 return _0 == other._0 &&
11173 _1 == other._1 &&
11174 _2 == other._2 &&
11175 _3 == other._3 &&
11176 _4 == other._4;
11177 }
11178 bool operator!=(const Oklch_Body& other) const {
11179 return _0 != other._0 ||
11180 _1 != other._1 ||
11181 _2 != other._2 ||
11182 _3 != other._3 ||
11183 _4 != other._4;
11184 }
11185 };
11186
11187 struct Color_Body {
11188 Tag tag;
11189 StyleOptional<OriginColor> _0;
11190 StyleColorComponent<StyleNumberOrPercentageComponent> _1;
11191 StyleColorComponent<StyleNumberOrPercentageComponent> _2;
11192 StyleColorComponent<StyleNumberOrPercentageComponent> _3;
11193 StyleColorComponent<StyleNumberOrPercentageComponent> _4;
11194 StyleColorSpace _5;
11195
11196 bool operator==(const Color_Body& other) const {
11197 return _0 == other._0 &&
11198 _1 == other._1 &&
11199 _2 == other._2 &&
11200 _3 == other._3 &&
11201 _4 == other._4 &&
11202 _5 == other._5;
11203 }
11204 bool operator!=(const Color_Body& other) const {
11205 return _0 != other._0 ||
11206 _1 != other._1 ||
11207 _2 != other._2 ||
11208 _3 != other._3 ||
11209 _4 != other._4 ||
11210 _5 != other._5;
11211 }
11212 };
11213
11214 struct {
11215 Tag tag;
11216 };
11217 Rgb_Body rgb;
11218 Hsl_Body hsl;
11219 Hwb_Body hwb;
11220 Lab_Body lab;
11221 Lch_Body lch;
11222 Oklab_Body oklab;
11223 Oklch_Body oklch;
11224 Color_Body color;
11225
11226 static StyleColorFunction Rgb(const StyleOptional<OriginColor> &_0,
11227 const StyleColorComponent<StyleNumberOrPercentageComponent> &_1,
11228 const StyleColorComponent<StyleNumberOrPercentageComponent> &_2,
11229 const StyleColorComponent<StyleNumberOrPercentageComponent> &_3,
11230 const StyleColorComponent<StyleNumberOrPercentageComponent> &_4) {
11231 StyleColorFunction result;
11232 ::new (&result.rgb._0) (StyleOptional<OriginColor>)(_0);
11233 ::new (&result.rgb._1) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_1);
11234 ::new (&result.rgb._2) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_2);
11235 ::new (&result.rgb._3) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_3);
11236 ::new (&result.rgb._4) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_4);
11237 result.tag = Tag::Rgb;
11238 return result;
11239 }
11240
11241 bool IsRgb() const {
11242 return tag == Tag::Rgb;
11243 }
11244
11245 const Rgb_Body& AsRgb() const {
11246 MOZ_DIAGNOSTIC_ASSERT(IsRgb())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRgb())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRgb()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsRgb()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11246); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRgb()"
")"); do { *((volatile int*)__null) = 11246; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11247 return rgb;
11248 }
11249
11250 static StyleColorFunction Hsl(const StyleOptional<OriginColor> &_0,
11251 const StyleColorComponent<StyleNumberOrAngleComponent> &_1,
11252 const StyleColorComponent<StyleNumberOrPercentageComponent> &_2,
11253 const StyleColorComponent<StyleNumberOrPercentageComponent> &_3,
11254 const StyleColorComponent<StyleNumberOrPercentageComponent> &_4) {
11255 StyleColorFunction result;
11256 ::new (&result.hsl._0) (StyleOptional<OriginColor>)(_0);
11257 ::new (&result.hsl._1) (StyleColorComponent<StyleNumberOrAngleComponent>)(_1);
11258 ::new (&result.hsl._2) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_2);
11259 ::new (&result.hsl._3) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_3);
11260 ::new (&result.hsl._4) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_4);
11261 result.tag = Tag::Hsl;
11262 return result;
11263 }
11264
11265 bool IsHsl() const {
11266 return tag == Tag::Hsl;
11267 }
11268
11269 const Hsl_Body& AsHsl() const {
11270 MOZ_DIAGNOSTIC_ASSERT(IsHsl())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsHsl())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsHsl()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsHsl()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11270); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsHsl()"
")"); do { *((volatile int*)__null) = 11270; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11271 return hsl;
11272 }
11273
11274 static StyleColorFunction Hwb(const StyleOptional<OriginColor> &_0,
11275 const StyleColorComponent<StyleNumberOrAngleComponent> &_1,
11276 const StyleColorComponent<StyleNumberOrPercentageComponent> &_2,
11277 const StyleColorComponent<StyleNumberOrPercentageComponent> &_3,
11278 const StyleColorComponent<StyleNumberOrPercentageComponent> &_4) {
11279 StyleColorFunction result;
11280 ::new (&result.hwb._0) (StyleOptional<OriginColor>)(_0);
11281 ::new (&result.hwb._1) (StyleColorComponent<StyleNumberOrAngleComponent>)(_1);
11282 ::new (&result.hwb._2) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_2);
11283 ::new (&result.hwb._3) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_3);
11284 ::new (&result.hwb._4) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_4);
11285 result.tag = Tag::Hwb;
11286 return result;
11287 }
11288
11289 bool IsHwb() const {
11290 return tag == Tag::Hwb;
11291 }
11292
11293 const Hwb_Body& AsHwb() const {
11294 MOZ_DIAGNOSTIC_ASSERT(IsHwb())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsHwb())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsHwb()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsHwb()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11294); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsHwb()"
")"); do { *((volatile int*)__null) = 11294; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11295 return hwb;
11296 }
11297
11298 static StyleColorFunction Lab(const StyleOptional<OriginColor> &_0,
11299 const StyleColorComponent<StyleNumberOrPercentageComponent> &_1,
11300 const StyleColorComponent<StyleNumberOrPercentageComponent> &_2,
11301 const StyleColorComponent<StyleNumberOrPercentageComponent> &_3,
11302 const StyleColorComponent<StyleNumberOrPercentageComponent> &_4) {
11303 StyleColorFunction result;
11304 ::new (&result.lab._0) (StyleOptional<OriginColor>)(_0);
11305 ::new (&result.lab._1) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_1);
11306 ::new (&result.lab._2) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_2);
11307 ::new (&result.lab._3) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_3);
11308 ::new (&result.lab._4) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_4);
11309 result.tag = Tag::Lab;
11310 return result;
11311 }
11312
11313 bool IsLab() const {
11314 return tag == Tag::Lab;
11315 }
11316
11317 const Lab_Body& AsLab() const {
11318 MOZ_DIAGNOSTIC_ASSERT(IsLab())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLab())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLab()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLab()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11318); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLab()"
")"); do { *((volatile int*)__null) = 11318; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11319 return lab;
11320 }
11321
11322 static StyleColorFunction Lch(const StyleOptional<OriginColor> &_0,
11323 const StyleColorComponent<StyleNumberOrPercentageComponent> &_1,
11324 const StyleColorComponent<StyleNumberOrPercentageComponent> &_2,
11325 const StyleColorComponent<StyleNumberOrAngleComponent> &_3,
11326 const StyleColorComponent<StyleNumberOrPercentageComponent> &_4) {
11327 StyleColorFunction result;
11328 ::new (&result.lch._0) (StyleOptional<OriginColor>)(_0);
11329 ::new (&result.lch._1) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_1);
11330 ::new (&result.lch._2) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_2);
11331 ::new (&result.lch._3) (StyleColorComponent<StyleNumberOrAngleComponent>)(_3);
11332 ::new (&result.lch._4) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_4);
11333 result.tag = Tag::Lch;
11334 return result;
11335 }
11336
11337 bool IsLch() const {
11338 return tag == Tag::Lch;
11339 }
11340
11341 const Lch_Body& AsLch() const {
11342 MOZ_DIAGNOSTIC_ASSERT(IsLch())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLch())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLch()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsLch()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11342); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLch()"
")"); do { *((volatile int*)__null) = 11342; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11343 return lch;
11344 }
11345
11346 static StyleColorFunction Oklab(const StyleOptional<OriginColor> &_0,
11347 const StyleColorComponent<StyleNumberOrPercentageComponent> &_1,
11348 const StyleColorComponent<StyleNumberOrPercentageComponent> &_2,
11349 const StyleColorComponent<StyleNumberOrPercentageComponent> &_3,
11350 const StyleColorComponent<StyleNumberOrPercentageComponent> &_4) {
11351 StyleColorFunction result;
11352 ::new (&result.oklab._0) (StyleOptional<OriginColor>)(_0);
11353 ::new (&result.oklab._1) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_1);
11354 ::new (&result.oklab._2) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_2);
11355 ::new (&result.oklab._3) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_3);
11356 ::new (&result.oklab._4) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_4);
11357 result.tag = Tag::Oklab;
11358 return result;
11359 }
11360
11361 bool IsOklab() const {
11362 return tag == Tag::Oklab;
11363 }
11364
11365 const Oklab_Body& AsOklab() const {
11366 MOZ_DIAGNOSTIC_ASSERT(IsOklab())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsOklab())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsOklab()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsOklab()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11366); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsOklab()"
")"); do { *((volatile int*)__null) = 11366; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11367 return oklab;
11368 }
11369
11370 static StyleColorFunction Oklch(const StyleOptional<OriginColor> &_0,
11371 const StyleColorComponent<StyleNumberOrPercentageComponent> &_1,
11372 const StyleColorComponent<StyleNumberOrPercentageComponent> &_2,
11373 const StyleColorComponent<StyleNumberOrAngleComponent> &_3,
11374 const StyleColorComponent<StyleNumberOrPercentageComponent> &_4) {
11375 StyleColorFunction result;
11376 ::new (&result.oklch._0) (StyleOptional<OriginColor>)(_0);
11377 ::new (&result.oklch._1) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_1);
11378 ::new (&result.oklch._2) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_2);
11379 ::new (&result.oklch._3) (StyleColorComponent<StyleNumberOrAngleComponent>)(_3);
11380 ::new (&result.oklch._4) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_4);
11381 result.tag = Tag::Oklch;
11382 return result;
11383 }
11384
11385 bool IsOklch() const {
11386 return tag == Tag::Oklch;
11387 }
11388
11389 const Oklch_Body& AsOklch() const {
11390 MOZ_DIAGNOSTIC_ASSERT(IsOklch())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsOklch())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsOklch()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsOklch()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11390); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsOklch()"
")"); do { *((volatile int*)__null) = 11390; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11391 return oklch;
11392 }
11393
11394 static StyleColorFunction Color(const StyleOptional<OriginColor> &_0,
11395 const StyleColorComponent<StyleNumberOrPercentageComponent> &_1,
11396 const StyleColorComponent<StyleNumberOrPercentageComponent> &_2,
11397 const StyleColorComponent<StyleNumberOrPercentageComponent> &_3,
11398 const StyleColorComponent<StyleNumberOrPercentageComponent> &_4,
11399 const StyleColorSpace &_5) {
11400 StyleColorFunction result;
11401 ::new (&result.color._0) (StyleOptional<OriginColor>)(_0);
11402 ::new (&result.color._1) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_1);
11403 ::new (&result.color._2) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_2);
11404 ::new (&result.color._3) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_3);
11405 ::new (&result.color._4) (StyleColorComponent<StyleNumberOrPercentageComponent>)(_4);
11406 ::new (&result.color._5) (StyleColorSpace)(_5);
11407 result.tag = Tag::Color;
11408 return result;
11409 }
11410
11411 bool IsColor() const {
11412 return tag == Tag::Color;
11413 }
11414
11415 const Color_Body& AsColor() const {
11416 MOZ_DIAGNOSTIC_ASSERT(IsColor())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsColor())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsColor()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsColor()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11416); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsColor()"
")"); do { *((volatile int*)__null) = 11416; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11417 return color;
11418 }
11419
11420 bool operator==(const StyleColorFunction& other) const {
11421 if (tag != other.tag) {
11422 return false;
11423 }
11424 switch (tag) {
11425 case Tag::Rgb: return rgb == other.rgb;
11426 case Tag::Hsl: return hsl == other.hsl;
11427 case Tag::Hwb: return hwb == other.hwb;
11428 case Tag::Lab: return lab == other.lab;
11429 case Tag::Lch: return lch == other.lch;
11430 case Tag::Oklab: return oklab == other.oklab;
11431 case Tag::Oklch: return oklch == other.oklch;
11432 case Tag::Color: return color == other.color;
11433
11434 }
11435 return true;
11436 }
11437
11438 bool operator!=(const StyleColorFunction& other) const {
11439 return !(*this == other);
11440 }
11441
11442 private:
11443 StyleColorFunction() {
11444
11445 }
11446 public:
11447
11448
11449 ~StyleColorFunction() {
11450 switch (tag) {
11451 case Tag::Rgb: rgb.~Rgb_Body(); break;
11452 case Tag::Hsl: hsl.~Hsl_Body(); break;
11453 case Tag::Hwb: hwb.~Hwb_Body(); break;
11454 case Tag::Lab: lab.~Lab_Body(); break;
11455 case Tag::Lch: lch.~Lch_Body(); break;
11456 case Tag::Oklab: oklab.~Oklab_Body(); break;
11457 case Tag::Oklch: oklch.~Oklch_Body(); break;
11458 case Tag::Color: color.~Color_Body(); break;
11459
11460 }
11461 }
11462
11463 StyleColorFunction(const StyleColorFunction& other)
11464 : tag(other.tag) {
11465 switch (tag) {
11466 case Tag::Rgb: ::new (&rgb) (Rgb_Body)(other.rgb); break;
11467 case Tag::Hsl: ::new (&hsl) (Hsl_Body)(other.hsl); break;
11468 case Tag::Hwb: ::new (&hwb) (Hwb_Body)(other.hwb); break;
11469 case Tag::Lab: ::new (&lab) (Lab_Body)(other.lab); break;
11470 case Tag::Lch: ::new (&lch) (Lch_Body)(other.lch); break;
11471 case Tag::Oklab: ::new (&oklab) (Oklab_Body)(other.oklab); break;
11472 case Tag::Oklch: ::new (&oklch) (Oklch_Body)(other.oklch); break;
11473 case Tag::Color: ::new (&color) (Color_Body)(other.color); break;
11474
11475 }
11476 }
11477 StyleColorFunction& operator=(const StyleColorFunction& other) {
11478 if (this != &other) {
11479 this->~StyleColorFunction();
11480 new (this) StyleColorFunction(other);
11481 }
11482 return *this;
11483 }
11484};
11485
11486/// https://drafts.csswg.org/css-color-4/#color-interpolation-method
11487struct StyleColorInterpolationMethod {
11488 /// The color-space the interpolation should be done in.
11489 StyleColorSpace space;
11490 /// The hue interpolation method.
11491 StyleHueInterpolationMethod hue;
11492
11493 bool operator==(const StyleColorInterpolationMethod& other) const {
11494 return space == other.space &&
11495 hue == other.hue;
11496 }
11497 bool operator!=(const StyleColorInterpolationMethod& other) const {
11498 return space != other.space ||
11499 hue != other.hue;
11500 }
11501};
11502
11503/// Flags used to modify the calculation of a color mix result.
11504struct StyleColorMixFlags {
11505 uint8_t _0;
11506
11507 constexpr explicit operator bool() const {
11508 return !!_0;
11509 }
11510 constexpr StyleColorMixFlags operator~() const {
11511 return StyleColorMixFlags { static_cast<decltype(_0)>(~_0) };
11512 }
11513 constexpr StyleColorMixFlags operator|(const StyleColorMixFlags& other) const {
11514 return StyleColorMixFlags { static_cast<decltype(_0)>(this->_0 | other._0) };
11515 }
11516 StyleColorMixFlags& operator|=(const StyleColorMixFlags& other) {
11517 *this = (*this | other);
11518 return *this;
11519 }
11520 constexpr StyleColorMixFlags operator&(const StyleColorMixFlags& other) const {
11521 return StyleColorMixFlags { static_cast<decltype(_0)>(this->_0 & other._0) };
11522 }
11523 StyleColorMixFlags& operator&=(const StyleColorMixFlags& other) {
11524 *this = (*this & other);
11525 return *this;
11526 }
11527 constexpr StyleColorMixFlags operator^(const StyleColorMixFlags& other) const {
11528 return StyleColorMixFlags { static_cast<decltype(_0)>(this->_0 ^ other._0) };
11529 }
11530 StyleColorMixFlags& operator^=(const StyleColorMixFlags& other) {
11531 *this = (*this ^ other);
11532 return *this;
11533 }
11534 bool operator==(const StyleColorMixFlags& other) const {
11535 return _0 == other._0;
11536 }
11537 bool operator!=(const StyleColorMixFlags& other) const {
11538 return _0 != other._0;
11539 }
11540 static const StyleColorMixFlags NORMALIZE_WEIGHTS;
11541 static const StyleColorMixFlags RESULT_IN_MODERN_SYNTAX;
11542};
11543/// Normalize the weights of the mix.
11544constexpr inline const StyleColorMixFlags StyleColorMixFlags::NORMALIZE_WEIGHTS = StyleColorMixFlags{ /* ._0 = */ (uint8_t)(1 << 0) };
11545/// The result should always be converted to the modern color syntax.
11546constexpr inline const StyleColorMixFlags StyleColorMixFlags::RESULT_IN_MODERN_SYNTAX = StyleColorMixFlags{ /* ._0 = */ (uint8_t)(1 << 1) };
11547
11548/// A restricted version of the css `color-mix()` function, which only supports
11549/// percentages.
11550///
11551/// https://drafts.csswg.org/css-color-5/#color-mix
11552template<typename Color, typename Percentage>
11553struct StyleGenericColorMix {
11554 StyleColorInterpolationMethod interpolation;
11555 Color left;
11556 Percentage left_percentage;
11557 Color right;
11558 Percentage right_percentage;
11559 StyleColorMixFlags flags;
11560
11561 bool operator==(const StyleGenericColorMix& other) const {
11562 return interpolation == other.interpolation &&
11563 left == other.left &&
11564 left_percentage == other.left_percentage &&
11565 right == other.right &&
11566 right_percentage == other.right_percentage &&
11567 flags == other.flags;
11568 }
11569 bool operator!=(const StyleGenericColorMix& other) const {
11570 return interpolation != other.interpolation ||
11571 left != other.left ||
11572 left_percentage != other.left_percentage ||
11573 right != other.right ||
11574 right_percentage != other.right_percentage ||
11575 flags != other.flags;
11576 }
11577};
11578
11579/// This struct represents a combined color from a numeric color and
11580/// the current foreground color (currentcolor keyword).
11581template<typename Percentage>
11582struct StyleGenericColor {
11583 enum class Tag {
11584 /// The actual numeric color.
11585 Absolute,
11586 /// A unresolvable color.
11587 ColorFunction,
11588 /// The `CurrentColor` keyword.
11589 CurrentColor,
11590 /// The color-mix() function.
11591 ColorMix,
11592 };
11593
11594 struct StyleAbsolute_Body {
11595 StyleAbsoluteColor _0;
11596
11597 bool operator==(const StyleAbsolute_Body& other) const {
11598 return _0 == other._0;
11599 }
11600 bool operator!=(const StyleAbsolute_Body& other) const {
11601 return _0 != other._0;
11602 }
11603 };
11604
11605 struct StyleColorFunction_Body {
11606 StyleBox<StyleColorFunction<StyleGenericColor>> _0;
11607
11608 bool operator==(const StyleColorFunction_Body& other) const {
11609 return _0 == other._0;
11610 }
11611 bool operator!=(const StyleColorFunction_Body& other) const {
11612 return _0 != other._0;
11613 }
11614 };
11615
11616 struct StyleColorMix_Body {
11617 StyleBox<StyleGenericColorMix<StyleGenericColor, Percentage>> _0;
11618
11619 bool operator==(const StyleColorMix_Body& other) const {
11620 return _0 == other._0;
11621 }
11622 bool operator!=(const StyleColorMix_Body& other) const {
11623 return _0 != other._0;
11624 }
11625 };
11626
11627 Tag tag;
11628 union {
11629 StyleAbsolute_Body absolute;
11630 StyleColorFunction_Body color_function;
11631 StyleColorMix_Body color_mix;
11632 };
11633
11634 static StyleGenericColor Absolute(const StyleAbsoluteColor &_0) {
11635 StyleGenericColor result;
11636 ::new (&result.absolute._0) (StyleAbsoluteColor)(_0);
11637 result.tag = Tag::Absolute;
11638 return result;
11639 }
11640
11641 bool IsAbsolute() const {
11642 return tag == Tag::Absolute;
11643 }
11644
11645 const StyleAbsoluteColor& AsAbsolute() const {
11646 MOZ_DIAGNOSTIC_ASSERT(IsAbsolute())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAbsolute())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAbsolute()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsAbsolute()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11646); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAbsolute()"
")"); do { *((volatile int*)__null) = 11646; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11647 return absolute._0;
11648 }
11649
11650 static StyleGenericColor ColorFunction(const StyleBox<StyleColorFunction<StyleGenericColor>> &_0) {
11651 StyleGenericColor result;
11652 ::new (&result.color_function._0) (StyleBox<StyleColorFunction<StyleGenericColor>>)(_0);
11653 result.tag = Tag::ColorFunction;
11654 return result;
11655 }
11656
11657 bool IsColorFunction() const {
11658 return tag == Tag::ColorFunction;
11659 }
11660
11661 const StyleBox<StyleColorFunction<StyleGenericColor>>& AsColorFunction() const {
11662 MOZ_DIAGNOSTIC_ASSERT(IsColorFunction())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsColorFunction())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsColorFunction()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("IsColorFunction()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11662); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsColorFunction()"
")"); do { *((volatile int*)__null) = 11662; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11663 return color_function._0;
11664 }
11665
11666 static StyleGenericColor CurrentColor() {
11667 StyleGenericColor result;
11668 result.tag = Tag::CurrentColor;
11669 return result;
11670 }
11671
11672 bool IsCurrentColor() const {
11673 return tag == Tag::CurrentColor;
11674 }
11675
11676 static StyleGenericColor ColorMix(const StyleBox<StyleGenericColorMix<StyleGenericColor, Percentage>> &_0) {
11677 StyleGenericColor result;
11678 ::new (&result.color_mix._0) (StyleBox<StyleGenericColorMix<StyleGenericColor, Percentage>>)(_0);
11679 result.tag = Tag::ColorMix;
11680 return result;
11681 }
11682
11683 bool IsColorMix() const {
11684 return tag == Tag::ColorMix;
11685 }
11686
11687 const StyleBox<StyleGenericColorMix<StyleGenericColor, Percentage>>& AsColorMix() const {
11688 MOZ_DIAGNOSTIC_ASSERT(IsColorMix())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsColorMix())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsColorMix()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsColorMix()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11688); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsColorMix()"
")"); do { *((volatile int*)__null) = 11688; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11689 return color_mix._0;
11690 }
11691
11692 bool operator==(const StyleGenericColor& other) const {
11693 if (tag != other.tag) {
11694 return false;
11695 }
11696 switch (tag) {
11697 case Tag::Absolute: return absolute == other.absolute;
11698 case Tag::ColorFunction: return color_function == other.color_function;
11699 case Tag::ColorMix: return color_mix == other.color_mix;
11700 default: break;
11701 }
11702 return true;
11703 }
11704
11705 bool operator!=(const StyleGenericColor& other) const {
11706 return !(*this == other);
11707 }
11708
11709 private:
11710 StyleGenericColor() {
11711
11712 }
11713 public:
11714
11715
11716 ~StyleGenericColor() {
11717 switch (tag) {
11718 case Tag::Absolute: absolute.~StyleAbsolute_Body(); break;
11719 case Tag::ColorFunction: color_function.~StyleColorFunction_Body(); break;
11720 case Tag::ColorMix: color_mix.~StyleColorMix_Body(); break;
11721 default: break;
11722 }
11723 }
11724
11725 StyleGenericColor(const StyleGenericColor& other)
11726 : tag(other.tag) {
11727 switch (tag) {
11728 case Tag::Absolute: ::new (&absolute) (StyleAbsolute_Body)(other.absolute); break;
11729 case Tag::ColorFunction: ::new (&color_function) (StyleColorFunction_Body)(other.color_function); break;
11730 case Tag::ColorMix: ::new (&color_mix) (StyleColorMix_Body)(other.color_mix); break;
11731 default: break;
11732 }
11733 }
11734 StyleGenericColor& operator=(const StyleGenericColor& other) {
11735 if (this != &other) {
11736 this->~StyleGenericColor();
11737 new (this) StyleGenericColor(other);
11738 }
11739 return *this;
11740 }
11741 static inline StyleGenericColor FromColor(nscolor);
11742
11743 static inline StyleGenericColor Transparent();
11744 static inline StyleGenericColor Black();
11745 static inline StyleGenericColor White();
11746
11747 bool MaybeTransparent() const;
11748
11749 /**
11750 * Compute the final color, taking into account the foreground color.
11751 **/
11752 StyleAbsoluteColor ResolveColor(const StyleAbsoluteColor&) const;
11753
11754 /**
11755 * Compute the final color, taking into account the foreground color from the
11756 * frame's ComputedStyle.
11757 */
11758 nscolor CalcColor(const nsIFrame*) const;
11759 /**
11760 * Compute the final color, taking into account the foreground color from the
11761 * style.
11762 */
11763 nscolor CalcColor(const ComputedStyle&) const;
11764 /**
11765 * Compute the final color, making the argument the foreground color.
11766 */
11767 nscolor CalcColor(nscolor) const;
11768 nscolor CalcColor(const StyleAbsoluteColor&) const;
11769};
11770
11771/// An animated value for `<color>`.
11772using StyleColor = StyleGenericColor<StylePercentage>;
11773
11774/// The leaves of a `<length-percentage>` calc expression.
11775union StyleCalcLengthPercentageLeaf {
11776 enum class Tag : uint8_t {
11777 Length,
11778 Percentage,
11779 Number,
11780 };
11781
11782 struct Length_Body {
11783 Tag tag;
11784 StyleLength _0;
11785
11786 bool operator==(const Length_Body& other) const {
11787 return _0 == other._0;
11788 }
11789 bool operator!=(const Length_Body& other) const {
11790 return _0 != other._0;
11791 }
11792 };
11793
11794 struct Percentage_Body {
11795 Tag tag;
11796 StylePercentage _0;
11797
11798 bool operator==(const Percentage_Body& other) const {
11799 return _0 == other._0;
11800 }
11801 bool operator!=(const Percentage_Body& other) const {
11802 return _0 != other._0;
11803 }
11804 };
11805
11806 struct Number_Body {
11807 Tag tag;
11808 float _0;
11809
11810 bool operator==(const Number_Body& other) const {
11811 return _0 == other._0;
11812 }
11813 bool operator!=(const Number_Body& other) const {
11814 return _0 != other._0;
11815 }
11816 };
11817
11818 struct {
11819 Tag tag;
11820 };
11821 Length_Body length;
11822 Percentage_Body percentage;
11823 Number_Body number;
11824
11825 static StyleCalcLengthPercentageLeaf Length(const StyleLength &_0) {
11826 StyleCalcLengthPercentageLeaf result;
11827 ::new (&result.length._0) (StyleLength)(_0);
11828 result.tag = Tag::Length;
11829 return result;
11830 }
11831
11832 bool IsLength() const {
11833 return tag == Tag::Length;
11834 }
11835
11836 const StyleLength& AsLength() const {
11837 MOZ_DIAGNOSTIC_ASSERT(IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLength()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11837); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLength()"
")"); do { *((volatile int*)__null) = 11837; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11838 return length._0;
11839 }
11840
11841 static StyleCalcLengthPercentageLeaf Percentage(const StylePercentage &_0) {
11842 StyleCalcLengthPercentageLeaf result;
11843 ::new (&result.percentage._0) (StylePercentage)(_0);
11844 result.tag = Tag::Percentage;
11845 return result;
11846 }
11847
11848 bool IsPercentage() const {
11849 return tag == Tag::Percentage;
11850 }
11851
11852 const StylePercentage& AsPercentage() const {
11853 MOZ_DIAGNOSTIC_ASSERT(IsPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPercentage()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11853); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPercentage()"
")"); do { *((volatile int*)__null) = 11853; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11854 return percentage._0;
11855 }
11856
11857 static StyleCalcLengthPercentageLeaf Number(const float &_0) {
11858 StyleCalcLengthPercentageLeaf result;
11859 ::new (&result.number._0) (float)(_0);
11860 result.tag = Tag::Number;
11861 return result;
11862 }
11863
11864 bool IsNumber() const {
11865 return tag == Tag::Number;
11866 }
11867
11868 const float& AsNumber() const {
11869 MOZ_DIAGNOSTIC_ASSERT(IsNumber())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsNumber())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsNumber()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsNumber()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 11869); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsNumber()"
")"); do { *((volatile int*)__null) = 11869; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
11870 return number._0;
11871 }
11872
11873 bool operator==(const StyleCalcLengthPercentageLeaf& other) const {
11874 if (tag != other.tag) {
11875 return false;
11876 }
11877 switch (tag) {
11878 case Tag::Length: return length == other.length;
11879 case Tag::Percentage: return percentage == other.percentage;
11880 case Tag::Number: return number == other.number;
11881
11882 }
11883 return true;
11884 }
11885
11886 bool operator!=(const StyleCalcLengthPercentageLeaf& other) const {
11887 return !(*this == other);
11888 }
11889
11890 private:
11891 StyleCalcLengthPercentageLeaf() {
11892
11893 }
11894 public:
11895
11896
11897 ~StyleCalcLengthPercentageLeaf() {
11898 switch (tag) {
11899 case Tag::Length: length.~Length_Body(); break;
11900 case Tag::Percentage: percentage.~Percentage_Body(); break;
11901 case Tag::Number: number.~Number_Body(); break;
11902
11903 }
11904 }
11905
11906 StyleCalcLengthPercentageLeaf(const StyleCalcLengthPercentageLeaf& other)
11907 : tag(other.tag) {
11908 switch (tag) {
11909 case Tag::Length: ::new (&length) (Length_Body)(other.length); break;
11910 case Tag::Percentage: ::new (&percentage) (Percentage_Body)(other.percentage); break;
11911 case Tag::Number: ::new (&number) (Number_Body)(other.number); break;
11912
11913 }
11914 }
11915 StyleCalcLengthPercentageLeaf& operator=(const StyleCalcLengthPercentageLeaf& other) {
11916 if (this != &other) {
11917 this->~StyleCalcLengthPercentageLeaf();
11918 new (this) StyleCalcLengthPercentageLeaf(other);
11919 }
11920 return *this;
11921 }
11922};
11923
11924/// The computed version of a calc() node for `<length-percentage>` values.
11925using StyleCalcNode = StyleGenericCalcNode<StyleCalcLengthPercentageLeaf>;
11926
11927/// The representation of a calc() function with mixed lengths and percentages.
11928struct StyleCalcLengthPercentage {
11929 StyleAllowedNumericType clamping_mode;
11930 StyleCalcNode node;
11931
11932 bool operator==(const StyleCalcLengthPercentage& other) const {
11933 return clamping_mode == other.clamping_mode &&
11934 node == other.node;
11935 }
11936 bool operator!=(const StyleCalcLengthPercentage& other) const {
11937 return clamping_mode != other.clamping_mode ||
11938 node != other.node;
11939 }
11940 inline CSSCoord ResolveToCSSPixels(CSSCoord aBasis) const;
11941 template<typename Rounder>
11942 inline nscoord Resolve(nscoord aBasis, Rounder) const;
11943};
11944
11945#if defined(CBINDGEN_IS_GECKO)
11946/// The value of an IntersectionObserver's rootMargin property.
11947///
11948/// Only bare px or percentage values are allowed. Other length units and
11949/// calc() values are not allowed.
11950///
11951/// <https://w3c.github.io/IntersectionObserver/#parse-a-root-margin>
11952using StyleIntersectionObserverRootMargin = StyleRect<StyleLengthPercentage>;
11953#endif
11954
11955/// A wrapper of Number, but the value >= 0.
11956using StyleNonNegativeNumber = StyleNonNegative<StyleCSSFloat>;
11957
11958/// A wrapper of values between zero and one.
11959template<typename T>
11960using StyleZeroToOne = T;
11961
11962/// A wrapper of Number, but the value between 0 and 1
11963using StyleZeroToOneNumber = StyleZeroToOne<StyleCSSFloat>;
11964
11965/// A wrapper of Length, whose value must be >= 0.
11966using StyleNonNegativeLength = StyleNonNegative<StyleLength>;
11967
11968/// A generic value for the `drop-shadow()` filter and the `text-shadow` property.
11969///
11970/// Contrary to the canonical order from the spec, the color is serialised
11971/// first, like in Gecko and Webkit.
11972template<typename Color, typename SizeLength, typename ShapeLength>
11973struct StyleGenericSimpleShadow {
11974 /// Color.
11975 Color color;
11976 /// Horizontal radius.
11977 SizeLength horizontal;
11978 /// Vertical radius.
11979 SizeLength vertical;
11980 /// Blur radius.
11981 ShapeLength blur;
11982
11983 bool operator==(const StyleGenericSimpleShadow& other) const {
11984 return color == other.color &&
11985 horizontal == other.horizontal &&
11986 vertical == other.vertical &&
11987 blur == other.blur;
11988 }
11989 bool operator!=(const StyleGenericSimpleShadow& other) const {
11990 return color != other.color ||
11991 horizontal != other.horizontal ||
11992 vertical != other.vertical ||
11993 blur != other.blur;
11994 }
11995};
11996
11997/// A computed value for the `drop-shadow()` filter.
11998using StyleSimpleShadow = StyleGenericSimpleShadow<StyleColor, StyleLength, StyleNonNegativeLength>;
11999
12000/// A generic value for a single `filter`.
12001template<typename Angle, typename NonNegativeFactor, typename ZeroToOneFactor, typename Length, typename Shadow, typename U>
12002struct StyleGenericFilter {
12003 enum class Tag : uint8_t {
12004 /// `blur(<length>)`
12005 Blur,
12006 /// `brightness(<factor>)`
12007 Brightness,
12008 /// `contrast(<factor>)`
12009 Contrast,
12010 /// `grayscale(<factor>)`
12011 Grayscale,
12012 /// `hue-rotate(<angle>)`
12013 HueRotate,
12014 /// `invert(<factor>)`
12015 Invert,
12016 /// `opacity(<factor>)`
12017 Opacity,
12018 /// `saturate(<factor>)`
12019 Saturate,
12020 /// `sepia(<factor>)`
12021 Sepia,
12022 /// `drop-shadow(...)`
12023 DropShadow,
12024 /// `<url>`
12025 Url,
12026 };
12027
12028 struct StyleBlur_Body {
12029 Length _0;
12030
12031 bool operator==(const StyleBlur_Body& other) const {
12032 return _0 == other._0;
12033 }
12034 bool operator!=(const StyleBlur_Body& other) const {
12035 return _0 != other._0;
12036 }
12037 };
12038
12039 struct StyleBrightness_Body {
12040 NonNegativeFactor _0;
12041
12042 bool operator==(const StyleBrightness_Body& other) const {
12043 return _0 == other._0;
12044 }
12045 bool operator!=(const StyleBrightness_Body& other) const {
12046 return _0 != other._0;
12047 }
12048 };
12049
12050 struct StyleContrast_Body {
12051 NonNegativeFactor _0;
12052
12053 bool operator==(const StyleContrast_Body& other) const {
12054 return _0 == other._0;
12055 }
12056 bool operator!=(const StyleContrast_Body& other) const {
12057 return _0 != other._0;
12058 }
12059 };
12060
12061 struct StyleGrayscale_Body {
12062 ZeroToOneFactor _0;
12063
12064 bool operator==(const StyleGrayscale_Body& other) const {
12065 return _0 == other._0;
12066 }
12067 bool operator!=(const StyleGrayscale_Body& other) const {
12068 return _0 != other._0;
12069 }
12070 };
12071
12072 struct StyleHueRotate_Body {
12073 Angle _0;
12074
12075 bool operator==(const StyleHueRotate_Body& other) const {
12076 return _0 == other._0;
12077 }
12078 bool operator!=(const StyleHueRotate_Body& other) const {
12079 return _0 != other._0;
12080 }
12081 };
12082
12083 struct StyleInvert_Body {
12084 ZeroToOneFactor _0;
12085
12086 bool operator==(const StyleInvert_Body& other) const {
12087 return _0 == other._0;
12088 }
12089 bool operator!=(const StyleInvert_Body& other) const {
12090 return _0 != other._0;
12091 }
12092 };
12093
12094 struct StyleOpacity_Body {
12095 ZeroToOneFactor _0;
12096
12097 bool operator==(const StyleOpacity_Body& other) const {
12098 return _0 == other._0;
12099 }
12100 bool operator!=(const StyleOpacity_Body& other) const {
12101 return _0 != other._0;
12102 }
12103 };
12104
12105 struct StyleSaturate_Body {
12106 NonNegativeFactor _0;
12107
12108 bool operator==(const StyleSaturate_Body& other) const {
12109 return _0 == other._0;
12110 }
12111 bool operator!=(const StyleSaturate_Body& other) const {
12112 return _0 != other._0;
12113 }
12114 };
12115
12116 struct StyleSepia_Body {
12117 ZeroToOneFactor _0;
12118
12119 bool operator==(const StyleSepia_Body& other) const {
12120 return _0 == other._0;
12121 }
12122 bool operator!=(const StyleSepia_Body& other) const {
12123 return _0 != other._0;
12124 }
12125 };
12126
12127 struct StyleDropShadow_Body {
12128 Shadow _0;
12129
12130 bool operator==(const StyleDropShadow_Body& other) const {
12131 return _0 == other._0;
12132 }
12133 bool operator!=(const StyleDropShadow_Body& other) const {
12134 return _0 != other._0;
12135 }
12136 };
12137
12138 struct StyleUrl_Body {
12139 U _0;
12140
12141 bool operator==(const StyleUrl_Body& other) const {
12142 return _0 == other._0;
12143 }
12144 bool operator!=(const StyleUrl_Body& other) const {
12145 return _0 != other._0;
12146 }
12147 };
12148
12149 Tag tag;
12150 union {
12151 StyleBlur_Body blur;
12152 StyleBrightness_Body brightness;
12153 StyleContrast_Body contrast;
12154 StyleGrayscale_Body grayscale;
12155 StyleHueRotate_Body hue_rotate;
12156 StyleInvert_Body invert;
12157 StyleOpacity_Body opacity;
12158 StyleSaturate_Body saturate;
12159 StyleSepia_Body sepia;
12160 StyleDropShadow_Body drop_shadow;
12161 StyleUrl_Body url;
12162 };
12163
12164 static StyleGenericFilter Blur(const Length &_0) {
12165 StyleGenericFilter result;
12166 ::new (&result.blur._0) (Length)(_0);
12167 result.tag = Tag::Blur;
12168 return result;
12169 }
12170
12171 bool IsBlur() const {
12172 return tag == Tag::Blur;
12173 }
12174
12175 const Length& AsBlur() const {
12176 MOZ_DIAGNOSTIC_ASSERT(IsBlur())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsBlur())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsBlur()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsBlur()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12176); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsBlur()"
")"); do { *((volatile int*)__null) = 12176; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12177 return blur._0;
12178 }
12179
12180 static StyleGenericFilter Brightness(const NonNegativeFactor &_0) {
12181 StyleGenericFilter result;
12182 ::new (&result.brightness._0) (NonNegativeFactor)(_0);
12183 result.tag = Tag::Brightness;
12184 return result;
12185 }
12186
12187 bool IsBrightness() const {
12188 return tag == Tag::Brightness;
12189 }
12190
12191 const NonNegativeFactor& AsBrightness() const {
12192 MOZ_DIAGNOSTIC_ASSERT(IsBrightness())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsBrightness())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsBrightness()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsBrightness()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12192); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsBrightness()"
")"); do { *((volatile int*)__null) = 12192; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12193 return brightness._0;
12194 }
12195
12196 static StyleGenericFilter Contrast(const NonNegativeFactor &_0) {
12197 StyleGenericFilter result;
12198 ::new (&result.contrast._0) (NonNegativeFactor)(_0);
12199 result.tag = Tag::Contrast;
12200 return result;
12201 }
12202
12203 bool IsContrast() const {
12204 return tag == Tag::Contrast;
12205 }
12206
12207 const NonNegativeFactor& AsContrast() const {
12208 MOZ_DIAGNOSTIC_ASSERT(IsContrast())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsContrast())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsContrast()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsContrast()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12208); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsContrast()"
")"); do { *((volatile int*)__null) = 12208; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12209 return contrast._0;
12210 }
12211
12212 static StyleGenericFilter Grayscale(const ZeroToOneFactor &_0) {
12213 StyleGenericFilter result;
12214 ::new (&result.grayscale._0) (ZeroToOneFactor)(_0);
12215 result.tag = Tag::Grayscale;
12216 return result;
12217 }
12218
12219 bool IsGrayscale() const {
12220 return tag == Tag::Grayscale;
12221 }
12222
12223 const ZeroToOneFactor& AsGrayscale() const {
12224 MOZ_DIAGNOSTIC_ASSERT(IsGrayscale())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsGrayscale())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsGrayscale()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsGrayscale()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12224); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsGrayscale()"
")"); do { *((volatile int*)__null) = 12224; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12225 return grayscale._0;
12226 }
12227
12228 static StyleGenericFilter HueRotate(const Angle &_0) {
12229 StyleGenericFilter result;
12230 ::new (&result.hue_rotate._0) (Angle)(_0);
12231 result.tag = Tag::HueRotate;
12232 return result;
12233 }
12234
12235 bool IsHueRotate() const {
12236 return tag == Tag::HueRotate;
12237 }
12238
12239 const Angle& AsHueRotate() const {
12240 MOZ_DIAGNOSTIC_ASSERT(IsHueRotate())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsHueRotate())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsHueRotate()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsHueRotate()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12240); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsHueRotate()"
")"); do { *((volatile int*)__null) = 12240; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12241 return hue_rotate._0;
12242 }
12243
12244 static StyleGenericFilter Invert(const ZeroToOneFactor &_0) {
12245 StyleGenericFilter result;
12246 ::new (&result.invert._0) (ZeroToOneFactor)(_0);
12247 result.tag = Tag::Invert;
12248 return result;
12249 }
12250
12251 bool IsInvert() const {
12252 return tag == Tag::Invert;
12253 }
12254
12255 const ZeroToOneFactor& AsInvert() const {
12256 MOZ_DIAGNOSTIC_ASSERT(IsInvert())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsInvert())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsInvert()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsInvert()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12256); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsInvert()"
")"); do { *((volatile int*)__null) = 12256; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12257 return invert._0;
12258 }
12259
12260 static StyleGenericFilter Opacity(const ZeroToOneFactor &_0) {
12261 StyleGenericFilter result;
12262 ::new (&result.opacity._0) (ZeroToOneFactor)(_0);
12263 result.tag = Tag::Opacity;
12264 return result;
12265 }
12266
12267 bool IsOpacity() const {
12268 return tag == Tag::Opacity;
12269 }
12270
12271 const ZeroToOneFactor& AsOpacity() const {
12272 MOZ_DIAGNOSTIC_ASSERT(IsOpacity())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsOpacity())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsOpacity()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsOpacity()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12272); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsOpacity()"
")"); do { *((volatile int*)__null) = 12272; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12273 return opacity._0;
12274 }
12275
12276 static StyleGenericFilter Saturate(const NonNegativeFactor &_0) {
12277 StyleGenericFilter result;
12278 ::new (&result.saturate._0) (NonNegativeFactor)(_0);
12279 result.tag = Tag::Saturate;
12280 return result;
12281 }
12282
12283 bool IsSaturate() const {
12284 return tag == Tag::Saturate;
12285 }
12286
12287 const NonNegativeFactor& AsSaturate() const {
12288 MOZ_DIAGNOSTIC_ASSERT(IsSaturate())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSaturate())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSaturate()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsSaturate()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12288); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSaturate()"
")"); do { *((volatile int*)__null) = 12288; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12289 return saturate._0;
12290 }
12291
12292 static StyleGenericFilter Sepia(const ZeroToOneFactor &_0) {
12293 StyleGenericFilter result;
12294 ::new (&result.sepia._0) (ZeroToOneFactor)(_0);
12295 result.tag = Tag::Sepia;
12296 return result;
12297 }
12298
12299 bool IsSepia() const {
12300 return tag == Tag::Sepia;
12301 }
12302
12303 const ZeroToOneFactor& AsSepia() const {
12304 MOZ_DIAGNOSTIC_ASSERT(IsSepia())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSepia())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSepia()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSepia()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12304); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSepia()"
")"); do { *((volatile int*)__null) = 12304; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12305 return sepia._0;
12306 }
12307
12308 static StyleGenericFilter DropShadow(const Shadow &_0) {
12309 StyleGenericFilter result;
12310 ::new (&result.drop_shadow._0) (Shadow)(_0);
12311 result.tag = Tag::DropShadow;
12312 return result;
12313 }
12314
12315 bool IsDropShadow() const {
12316 return tag == Tag::DropShadow;
12317 }
12318
12319 const Shadow& AsDropShadow() const {
12320 MOZ_DIAGNOSTIC_ASSERT(IsDropShadow())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsDropShadow())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsDropShadow()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsDropShadow()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12320); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsDropShadow()"
")"); do { *((volatile int*)__null) = 12320; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12321 return drop_shadow._0;
12322 }
12323
12324 static StyleGenericFilter Url(const U &_0) {
12325 StyleGenericFilter result;
12326 ::new (&result.url._0) (U)(_0);
12327 result.tag = Tag::Url;
12328 return result;
12329 }
12330
12331 bool IsUrl() const {
12332 return tag == Tag::Url;
12333 }
12334
12335 const U& AsUrl() const {
12336 MOZ_DIAGNOSTIC_ASSERT(IsUrl())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsUrl())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsUrl()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsUrl()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12336); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsUrl()"
")"); do { *((volatile int*)__null) = 12336; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12337 return url._0;
12338 }
12339
12340 bool operator==(const StyleGenericFilter& other) const {
12341 if (tag != other.tag) {
12342 return false;
12343 }
12344 switch (tag) {
12345 case Tag::Blur: return blur == other.blur;
12346 case Tag::Brightness: return brightness == other.brightness;
12347 case Tag::Contrast: return contrast == other.contrast;
12348 case Tag::Grayscale: return grayscale == other.grayscale;
12349 case Tag::HueRotate: return hue_rotate == other.hue_rotate;
12350 case Tag::Invert: return invert == other.invert;
12351 case Tag::Opacity: return opacity == other.opacity;
12352 case Tag::Saturate: return saturate == other.saturate;
12353 case Tag::Sepia: return sepia == other.sepia;
12354 case Tag::DropShadow: return drop_shadow == other.drop_shadow;
12355 case Tag::Url: return url == other.url;
12356
12357 }
12358 return true;
12359 }
12360
12361 bool operator!=(const StyleGenericFilter& other) const {
12362 return !(*this == other);
12363 }
12364
12365 private:
12366 StyleGenericFilter() {
12367
12368 }
12369 public:
12370
12371
12372 ~StyleGenericFilter() {
12373 switch (tag) {
12374 case Tag::Blur: blur.~StyleBlur_Body(); break;
12375 case Tag::Brightness: brightness.~StyleBrightness_Body(); break;
12376 case Tag::Contrast: contrast.~StyleContrast_Body(); break;
12377 case Tag::Grayscale: grayscale.~StyleGrayscale_Body(); break;
12378 case Tag::HueRotate: hue_rotate.~StyleHueRotate_Body(); break;
12379 case Tag::Invert: invert.~StyleInvert_Body(); break;
12380 case Tag::Opacity: opacity.~StyleOpacity_Body(); break;
12381 case Tag::Saturate: saturate.~StyleSaturate_Body(); break;
12382 case Tag::Sepia: sepia.~StyleSepia_Body(); break;
12383 case Tag::DropShadow: drop_shadow.~StyleDropShadow_Body(); break;
12384 case Tag::Url: url.~StyleUrl_Body(); break;
12385
12386 }
12387 }
12388
12389 StyleGenericFilter(const StyleGenericFilter& other)
12390 : tag(other.tag) {
12391 switch (tag) {
12392 case Tag::Blur: ::new (&blur) (StyleBlur_Body)(other.blur); break;
12393 case Tag::Brightness: ::new (&brightness) (StyleBrightness_Body)(other.brightness); break;
12394 case Tag::Contrast: ::new (&contrast) (StyleContrast_Body)(other.contrast); break;
12395 case Tag::Grayscale: ::new (&grayscale) (StyleGrayscale_Body)(other.grayscale); break;
12396 case Tag::HueRotate: ::new (&hue_rotate) (StyleHueRotate_Body)(other.hue_rotate); break;
12397 case Tag::Invert: ::new (&invert) (StyleInvert_Body)(other.invert); break;
12398 case Tag::Opacity: ::new (&opacity) (StyleOpacity_Body)(other.opacity); break;
12399 case Tag::Saturate: ::new (&saturate) (StyleSaturate_Body)(other.saturate); break;
12400 case Tag::Sepia: ::new (&sepia) (StyleSepia_Body)(other.sepia); break;
12401 case Tag::DropShadow: ::new (&drop_shadow) (StyleDropShadow_Body)(other.drop_shadow); break;
12402 case Tag::Url: ::new (&url) (StyleUrl_Body)(other.url); break;
12403
12404 }
12405 }
12406 StyleGenericFilter& operator=(const StyleGenericFilter& other) {
12407 if (this != &other) {
12408 this->~StyleGenericFilter();
12409 new (this) StyleGenericFilter(other);
12410 }
12411 return *this;
12412 }
12413};
12414
12415#if defined(CBINDGEN_IS_GECKO)
12416/// A computed value for a single `filter`.
12417using StyleFilter = StyleGenericFilter<StyleAngle, StyleNonNegativeNumber, StyleZeroToOneNumber, StyleNonNegativeLength, StyleSimpleShadow, StyleComputedUrl>;
12418#endif
12419
12420#if defined(CBINDGEN_IS_SERVO)
12421/// A computed value for a single `filter`.
12422using StyleFilter = StyleGenericFilter<StyleAngle, StyleNonNegativeNumber, StyleZeroToOneNumber, StyleNonNegativeLength, StyleImpossible, StyleImpossible>;
12423#endif
12424
12425/// The name of a font family of choice.
12426struct StyleFamilyName {
12427 /// Name of the font family.
12428 StyleAtom name;
12429 /// Syntax of the font family.
12430 StyleFontFamilyNameSyntax syntax;
12431
12432 bool operator==(const StyleFamilyName& other) const {
12433 return name == other.name &&
12434 syntax == other.syntax;
12435 }
12436 bool operator!=(const StyleFamilyName& other) const {
12437 return name != other.name ||
12438 syntax != other.syntax;
12439 }
12440};
12441
12442/// A set of faces that vary in weight, width or slope.
12443union StyleSingleFontFamily {
12444 enum class Tag : uint8_t {
12445 /// The name of a font family of choice.
12446 FamilyName,
12447 /// Generic family name.
12448 Generic,
12449 };
12450
12451 struct FamilyName_Body {
12452 Tag tag;
12453 StyleFamilyName _0;
12454
12455 bool operator==(const FamilyName_Body& other) const {
12456 return _0 == other._0;
12457 }
12458 bool operator!=(const FamilyName_Body& other) const {
12459 return _0 != other._0;
12460 }
12461 };
12462
12463 struct Generic_Body {
12464 Tag tag;
12465 StyleGenericFontFamily _0;
12466
12467 bool operator==(const Generic_Body& other) const {
12468 return _0 == other._0;
12469 }
12470 bool operator!=(const Generic_Body& other) const {
12471 return _0 != other._0;
12472 }
12473 };
12474
12475 struct {
12476 Tag tag;
12477 };
12478 FamilyName_Body family_name;
12479 Generic_Body generic;
12480
12481 static StyleSingleFontFamily FamilyName(const StyleFamilyName &_0) {
12482 StyleSingleFontFamily result;
12483 ::new (&result.family_name._0) (StyleFamilyName)(_0);
12484 result.tag = Tag::FamilyName;
12485 return result;
12486 }
12487
12488 bool IsFamilyName() const {
12489 return tag == Tag::FamilyName;
12490 }
12491
12492 const StyleFamilyName& AsFamilyName() const {
12493 MOZ_DIAGNOSTIC_ASSERT(IsFamilyName())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsFamilyName())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsFamilyName()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsFamilyName()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12493); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsFamilyName()"
")"); do { *((volatile int*)__null) = 12493; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12494 return family_name._0;
12495 }
12496
12497 StyleFamilyName& AsFamilyName() {
12498 MOZ_DIAGNOSTIC_ASSERT(IsFamilyName())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsFamilyName())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsFamilyName()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsFamilyName()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12498); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsFamilyName()"
")"); do { *((volatile int*)__null) = 12498; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12499 return family_name._0;
12500 }
12501
12502 static StyleSingleFontFamily Generic(const StyleGenericFontFamily &_0) {
12503 StyleSingleFontFamily result;
12504 ::new (&result.generic._0) (StyleGenericFontFamily)(_0);
12505 result.tag = Tag::Generic;
12506 return result;
12507 }
12508
12509 bool IsGeneric() const {
12510 return tag == Tag::Generic;
12511 }
12512
12513 const StyleGenericFontFamily& AsGeneric() const {
12514 MOZ_DIAGNOSTIC_ASSERT(IsGeneric())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsGeneric())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsGeneric()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsGeneric()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12514); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsGeneric()"
")"); do { *((volatile int*)__null) = 12514; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12515 return generic._0;
12516 }
12517
12518 StyleGenericFontFamily& AsGeneric() {
12519 MOZ_DIAGNOSTIC_ASSERT(IsGeneric())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsGeneric())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsGeneric()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsGeneric()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12519); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsGeneric()"
")"); do { *((volatile int*)__null) = 12519; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12520 return generic._0;
12521 }
12522
12523 bool operator==(const StyleSingleFontFamily& other) const {
12524 if (tag != other.tag) {
12525 return false;
12526 }
12527 switch (tag) {
12528 case Tag::FamilyName: return family_name == other.family_name;
12529 case Tag::Generic: return generic == other.generic;
12530
12531 }
12532 return true;
12533 }
12534
12535 bool operator!=(const StyleSingleFontFamily& other) const {
12536 return !(*this == other);
12537 }
12538
12539 private:
12540 StyleSingleFontFamily() {
12541
12542 }
12543 public:
12544
12545
12546 ~StyleSingleFontFamily() {
12547 switch (tag) {
12548 case Tag::FamilyName: family_name.~FamilyName_Body(); break;
12549 case Tag::Generic: generic.~Generic_Body(); break;
12550
12551 }
12552 }
12553
12554 StyleSingleFontFamily(const StyleSingleFontFamily& other)
12555 : tag(other.tag) {
12556 switch (tag) {
12557 case Tag::FamilyName: ::new (&family_name) (FamilyName_Body)(other.family_name); break;
12558 case Tag::Generic: ::new (&generic) (Generic_Body)(other.generic); break;
12559
12560 }
12561 }
12562 StyleSingleFontFamily& operator=(const StyleSingleFontFamily& other) {
12563 if (this != &other) {
12564 this->~StyleSingleFontFamily();
12565 new (this) StyleSingleFontFamily(other);
12566 }
12567 return *this;
12568 }
12569 static StyleSingleFontFamily Parse(const nsACString& aName);
12570 void AppendToString(nsACString& aFamily, bool aIncludeQuotes = true) const;
12571 bool IsNamedFamily(const nsAString&) const;
12572};
12573
12574/// A list of font families.
12575struct StyleFontFamilyList {
12576 /// The actual list of font families specified.
12577 StyleArcSlice<StyleSingleFontFamily> list;
12578
12579 bool operator==(const StyleFontFamilyList& other) const {
12580 return list == other.list;
12581 }
12582 bool operator!=(const StyleFontFamilyList& other) const {
12583 return list != other.list;
12584 }
12585 static StyleFontFamilyList WithOneUnquotedFamily(const nsACString&);
12586 // Constructs a font family list with a list of names.
12587 static StyleFontFamilyList WithNames(nsTArray<StyleSingleFontFamily>&&);
12588};
12589
12590/// This is an alias which is useful mostly as a cbindgen / C++ inference
12591/// workaround.
12592using StyleFontStyleFixedPoint = StyleFixedPoint<int16_t, StyleFONT_STYLE_FRACTION_BITS>;
12593
12594/// The computed value of `font-style`.
12595///
12596/// - Define out of range values min value (-128.0) as meaning 'normal'
12597/// - Define max value (127.99609375) as 'italic'
12598/// - Other values represent 'oblique <angle>'
12599/// - Note that 'oblique 0deg' is distinct from 'normal' (should it be?)
12600///
12601struct StyleFontStyle {
12602 StyleFontStyleFixedPoint _0;
12603
12604 bool operator==(const StyleFontStyle& other) const {
12605 return _0 == other._0;
12606 }
12607 bool operator!=(const StyleFontStyle& other) const {
12608 return _0 != other._0;
12609 }
12610 bool operator<(const StyleFontStyle& other) const {
12611 return _0 < other._0;
12612 }
12613 bool operator<=(const StyleFontStyle& other) const {
12614 return _0 <= other._0;
12615 }
12616 bool operator>(const StyleFontStyle& other) const {
12617 return _0 > other._0;
12618 }
12619 bool operator>=(const StyleFontStyle& other) const {
12620 return _0 >= other._0;
12621 }
12622 SERVO_FIXED_POINT_HELPERS(StyleFontStyle, int16_t, StyleFONT_STYLE_FRACTION_BITS)static constexpr int16_t kPointFive = 1 << (StyleFONT_STYLE_FRACTION_BITS
- 1); static constexpr uint16_t kScale = 1 << StyleFONT_STYLE_FRACTION_BITS
; static constexpr float kInverseScale = 1.0f / kScale; static
StyleFontStyle FromRaw(int16_t aRaw) { return {{aRaw}}; } static
StyleFontStyle FromFloat(float aFloat) { return FromRaw(int16_t
(aFloat * kScale)); } static StyleFontStyle FromInt(int16_t aInt
) { return FromRaw(int16_t(aInt * kScale)); } int16_t Raw() const
{ return _0.value; } uint16_t UnsignedRaw() const { return uint16_t
(Raw()); } float ToFloat() const { return Raw() * kInverseScale
; } int16_t ToIntRounded() const { return (Raw() + kPointFive
) >> StyleFONT_STYLE_FRACTION_BITS; } inline void ToString
(nsACString&) const;
;
12623 bool IsNormal() const { return *this == NORMAL; }
12624 inline bool IsItalic() const;
12625 inline bool IsOblique() const;
12626 inline float ObliqueAngle() const; // Only for use when IsOblique() is true
12627 inline float SlantAngle() const; // Returns angle for any font-style, including
12628 // normal/italic as well as explicit oblique
12629 static const StyleFontStyle NORMAL;
12630 static const StyleFontStyle ITALIC;
12631 static const int16_t DEFAULT_OBLIQUE_DEGREES;
12632 static const StyleFontStyle OBLIQUE;
12633};
12634/// The normal keyword.
12635constexpr inline const StyleFontStyle StyleFontStyle::NORMAL = StyleFontStyle{ /* ._0 = */ StyleFontStyleFixedPoint{ /* .value = */ (100 << StyleFONT_STYLE_FRACTION_BITS) } };
12636/// The italic keyword.
12637constexpr inline const StyleFontStyle StyleFontStyle::ITALIC = StyleFontStyle{ /* ._0 = */ StyleFontStyleFixedPoint{ /* .value = */ (101 << StyleFONT_STYLE_FRACTION_BITS) } };
12638/// The default angle for `font-style: oblique`.
12639/// See also https://github.com/w3c/csswg-drafts/issues/2295
12640constexpr inline const int16_t StyleFontStyle::DEFAULT_OBLIQUE_DEGREES = 14;
12641/// The `oblique` keyword with the default degrees.
12642constexpr inline const StyleFontStyle StyleFontStyle::OBLIQUE = StyleFontStyle{ /* ._0 = */ StyleFontStyleFixedPoint{ /* .value = */ (StyleFontStyle::DEFAULT_OBLIQUE_DEGREES << StyleFONT_STYLE_FRACTION_BITS) } };
12643
12644/// This is an alias which is useful mostly as a cbindgen / C++ inference
12645/// workaround.
12646using StyleFontWeightFixedPoint = StyleFixedPoint<uint16_t, StyleFONT_WEIGHT_FRACTION_BITS>;
12647
12648/// A value for the font-weight property per:
12649///
12650/// https://drafts.csswg.org/css-fonts-4/#propdef-font-weight
12651///
12652struct StyleFontWeight {
12653 StyleFontWeightFixedPoint _0;
12654
12655 bool operator==(const StyleFontWeight& other) const {
12656 return _0 == other._0;
12657 }
12658 bool operator!=(const StyleFontWeight& other) const {
12659 return _0 != other._0;
12660 }
12661 bool operator<(const StyleFontWeight& other) const {
12662 return _0 < other._0;
12663 }
12664 bool operator<=(const StyleFontWeight& other) const {
12665 return _0 <= other._0;
12666 }
12667 bool operator>(const StyleFontWeight& other) const {
12668 return _0 > other._0;
12669 }
12670 bool operator>=(const StyleFontWeight& other) const {
12671 return _0 >= other._0;
12672 }
12673 SERVO_FIXED_POINT_HELPERS(StyleFontWeight, uint16_t, StyleFONT_WEIGHT_FRACTION_BITS)static constexpr uint16_t kPointFive = 1 << (StyleFONT_WEIGHT_FRACTION_BITS
- 1); static constexpr uint16_t kScale = 1 << StyleFONT_WEIGHT_FRACTION_BITS
; static constexpr float kInverseScale = 1.0f / kScale; static
StyleFontWeight FromRaw(uint16_t aRaw) { return {{aRaw}}; } static
StyleFontWeight FromFloat(float aFloat) { return FromRaw(uint16_t
(aFloat * kScale)); } static StyleFontWeight FromInt(uint16_t
aInt) { return FromRaw(uint16_t(aInt * kScale)); } uint16_t Raw
() const { return _0.value; } uint16_t UnsignedRaw() const { return
uint16_t(Raw()); } float ToFloat() const { return Raw() * kInverseScale
; } uint16_t ToIntRounded() const { return (Raw() + kPointFive
) >> StyleFONT_WEIGHT_FRACTION_BITS; } inline void ToString
(nsACString&) const;
;
12674 bool IsNormal() const { return *this == NORMAL; }
12675
12676 inline bool IsBold() const;
12677 static const StyleFontWeight NORMAL;
12678 static const StyleFontWeight BOLD;
12679 static const StyleFontWeight BOLD_THRESHOLD;
12680};
12681/// The `normal` keyword.
12682constexpr inline const StyleFontWeight StyleFontWeight::NORMAL = StyleFontWeight{ /* ._0 = */ StyleFontWeightFixedPoint{ /* .value = */ (400 << StyleFONT_WEIGHT_FRACTION_BITS) } };
12683/// The `bold` value.
12684constexpr inline const StyleFontWeight StyleFontWeight::BOLD = StyleFontWeight{ /* ._0 = */ StyleFontWeightFixedPoint{ /* .value = */ (700 << StyleFONT_WEIGHT_FRACTION_BITS) } };
12685/// The threshold from which we consider a font bold.
12686constexpr inline const StyleFontWeight StyleFontWeight::BOLD_THRESHOLD = StyleFontWeight{ /* ._0 = */ StyleFontWeightFixedPoint{ /* .value = */ (600 << StyleFONT_WEIGHT_FRACTION_BITS) } };
12687
12688/// Specifies a prioritized list of font family names or generic family names.
12689struct StyleFontFamily {
12690 /// The actual list of family names.
12691 StyleFontFamilyList families;
12692 /// Whether this font-family came from a specified system-font.
12693 bool is_system_font;
12694 /// Whether this is the initial font-family that might react to language
12695 /// changes.
12696 bool is_initial;
12697
12698 bool operator==(const StyleFontFamily& other) const {
12699 return families == other.families &&
12700 is_system_font == other.is_system_font &&
12701 is_initial == other.is_initial;
12702 }
12703 bool operator!=(const StyleFontFamily& other) const {
12704 return families != other.families ||
12705 is_system_font != other.is_system_font ||
12706 is_initial != other.is_initial;
12707 }
12708};
12709
12710struct StylePropDef {
12711 StyleAtom name;
12712 nsCString syntax;
12713 bool inherits;
12714 bool has_initial_value;
12715 nsCString initial_value;
12716 bool from_js;
12717
12718 bool operator==(const StylePropDef& other) const {
12719 return name == other.name &&
12720 syntax == other.syntax &&
12721 inherits == other.inherits &&
12722 has_initial_value == other.has_initial_value &&
12723 initial_value == other.initial_value &&
12724 from_js == other.from_js;
12725 }
12726 bool operator!=(const StylePropDef& other) const {
12727 return name != other.name ||
12728 syntax != other.syntax ||
12729 inherits != other.inherits ||
12730 has_initial_value != other.has_initial_value ||
12731 initial_value != other.initial_value ||
12732 from_js != other.from_js;
12733 }
12734};
12735
12736struct StyleSelectorWarningData {
12737 /// Index to the selector generating the warning.
12738 uintptr_t index;
12739 /// Kind of the warning.
12740 StyleSelectorWarningKind kind;
12741
12742 bool operator==(const StyleSelectorWarningData& other) const {
12743 return index == other.index &&
12744 kind == other.kind;
12745 }
12746 bool operator!=(const StyleSelectorWarningData& other) const {
12747 return index != other.index ||
12748 kind != other.kind;
12749 }
12750};
12751
12752struct StyleCSSToken {
12753 nsCString text;
12754 nsCString token_type;
12755 bool has_unit;
12756 nsCString unit;
12757 bool has_number;
12758 float number;
12759 bool has_value;
12760 nsCString value;
12761 uint32_t line;
12762 uint32_t column;
12763
12764 bool operator==(const StyleCSSToken& other) const {
12765 return text == other.text &&
12766 token_type == other.token_type &&
12767 has_unit == other.has_unit &&
12768 unit == other.unit &&
12769 has_number == other.has_number &&
12770 number == other.number &&
12771 has_value == other.has_value &&
12772 value == other.value &&
12773 line == other.line &&
12774 column == other.column;
12775 }
12776 bool operator!=(const StyleCSSToken& other) const {
12777 return text != other.text ||
12778 token_type != other.token_type ||
12779 has_unit != other.has_unit ||
12780 unit != other.unit ||
12781 has_number != other.has_number ||
12782 number != other.number ||
12783 has_value != other.has_value ||
12784 value != other.value ||
12785 line != other.line ||
12786 column != other.column;
12787 }
12788};
12789
12790/// https://drafts.csswg.org/css-anchor-position-1/#propdef-anchor-name
12791using StyleAnchorName = StyleArcSlice<StyleDashedIdent>;
12792
12793/// https://drafts.csswg.org/css-anchor-position-1/#propdef-scope
12794union StyleAnchorScope {
12795 enum class Tag : uint8_t {
12796 /// `none`
12797 None,
12798 /// `all`
12799 All,
12800 /// `<dashed-ident>#`
12801 Idents,
12802 };
12803
12804 struct Idents_Body {
12805 Tag tag;
12806 StyleArcSlice<StyleDashedIdent> _0;
12807
12808 bool operator==(const Idents_Body& other) const {
12809 return _0 == other._0;
12810 }
12811 bool operator!=(const Idents_Body& other) const {
12812 return _0 != other._0;
12813 }
12814 };
12815
12816 struct {
12817 Tag tag;
12818 };
12819 Idents_Body idents;
12820
12821 static StyleAnchorScope None() {
12822 StyleAnchorScope result;
12823 result.tag = Tag::None;
12824 return result;
12825 }
12826
12827 bool IsNone() const {
12828 return tag == Tag::None;
12829 }
12830
12831 static StyleAnchorScope All() {
12832 StyleAnchorScope result;
12833 result.tag = Tag::All;
12834 return result;
12835 }
12836
12837 bool IsAll() const {
12838 return tag == Tag::All;
12839 }
12840
12841 static StyleAnchorScope Idents(const StyleArcSlice<StyleDashedIdent> &_0) {
12842 StyleAnchorScope result;
12843 ::new (&result.idents._0) (StyleArcSlice<StyleDashedIdent>)(_0);
12844 result.tag = Tag::Idents;
12845 return result;
12846 }
12847
12848 bool IsIdents() const {
12849 return tag == Tag::Idents;
12850 }
12851
12852 const StyleArcSlice<StyleDashedIdent>& AsIdents() const {
12853 MOZ_DIAGNOSTIC_ASSERT(IsIdents())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsIdents())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsIdents()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsIdents()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12853); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsIdents()"
")"); do { *((volatile int*)__null) = 12853; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12854 return idents._0;
12855 }
12856
12857 bool operator==(const StyleAnchorScope& other) const {
12858 if (tag != other.tag) {
12859 return false;
12860 }
12861 switch (tag) {
12862 case Tag::Idents: return idents == other.idents;
12863 default: break;
12864 }
12865 return true;
12866 }
12867
12868 bool operator!=(const StyleAnchorScope& other) const {
12869 return !(*this == other);
12870 }
12871
12872 private:
12873 StyleAnchorScope() {
12874
12875 }
12876 public:
12877
12878
12879 ~StyleAnchorScope() {
12880 switch (tag) {
12881 case Tag::Idents: idents.~Idents_Body(); break;
12882 default: break;
12883 }
12884 }
12885
12886 StyleAnchorScope(const StyleAnchorScope& other)
12887 : tag(other.tag) {
12888 switch (tag) {
12889 case Tag::Idents: ::new (&idents) (Idents_Body)(other.idents); break;
12890 default: break;
12891 }
12892 }
12893 StyleAnchorScope& operator=(const StyleAnchorScope& other) {
12894 if (this != &other) {
12895 this->~StyleAnchorScope();
12896 new (this) StyleAnchorScope(other);
12897 }
12898 return *this;
12899 }
12900};
12901
12902/// The <keyframes-name>.
12903///
12904/// <https://drafts.csswg.org/css-animations/#typedef-keyframes-name>
12905///
12906/// We use a single atom for this. Empty atom represents `none` animation.
12907using StyleKeyframesName = StyleAtom;
12908
12909/// A value for the `animation-name` property.
12910struct StyleAnimationName {
12911 StyleKeyframesName _0;
12912
12913 bool operator==(const StyleAnimationName& other) const {
12914 return _0 == other._0;
12915 }
12916 bool operator!=(const StyleAnimationName& other) const {
12917 return _0 != other._0;
12918 }
12919 public:
12920 StyleAnimationName() : _0(nsGkAtoms::_empty) {}
12921};
12922
12923/// The typedef of scroll-timeline-name or view-timeline-name.
12924///
12925/// https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-name
12926/// https://drafts.csswg.org/scroll-animations-1/#view-timeline-name
12927struct StyleTimelineName {
12928 StyleDashedIdent _0;
12929
12930 bool operator==(const StyleTimelineName& other) const {
12931 return _0 == other._0;
12932 }
12933 bool operator!=(const StyleTimelineName& other) const {
12934 return _0 != other._0;
12935 }
12936 public:
12937 StyleTimelineName() : _0(nsGkAtoms::_empty) {}
12938 nsAtom* AsAtom() const { return _0.AsAtom(); }
12939};
12940
12941/// The scroll() notation.
12942/// https://drafts.csswg.org/scroll-animations-1/#scroll-notation
12943struct StyleScrollFunction {
12944 /// The scroll container element whose scroll position drives the progress of the timeline.
12945 StyleScroller scroller;
12946 /// The axis of scrolling that drives the progress of the timeline.
12947 StyleScrollAxis axis;
12948
12949 bool operator==(const StyleScrollFunction& other) const {
12950 return scroller == other.scroller &&
12951 axis == other.axis;
12952 }
12953 bool operator!=(const StyleScrollFunction& other) const {
12954 return scroller != other.scroller ||
12955 axis != other.axis;
12956 }
12957};
12958
12959/// A `<length-percentage> | auto` value.
12960template<typename LengthPercent>
12961struct StyleGenericLengthPercentageOrAuto {
12962 enum class Tag : uint8_t {
12963 LengthPercentage,
12964 Auto,
12965 };
12966
12967 struct StyleLengthPercentage_Body {
12968 LengthPercent _0;
12969
12970 bool operator==(const StyleLengthPercentage_Body& other) const {
12971 return _0 == other._0;
12972 }
12973 bool operator!=(const StyleLengthPercentage_Body& other) const {
12974 return _0 != other._0;
12975 }
12976 };
12977
12978 Tag tag;
12979 union {
12980 StyleLengthPercentage_Body length_percentage;
12981 };
12982
12983 static StyleGenericLengthPercentageOrAuto LengthPercentage(const LengthPercent &_0) {
12984 StyleGenericLengthPercentageOrAuto result;
12985 ::new (&result.length_percentage._0) (LengthPercent)(_0);
12986 result.tag = Tag::LengthPercentage;
12987 return result;
12988 }
12989
12990 bool IsLengthPercentage() const {
12991 return tag == Tag::LengthPercentage;
12992 }
12993
12994 const LengthPercent& AsLengthPercentage() const {
12995 MOZ_DIAGNOSTIC_ASSERT(IsLengthPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLengthPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLengthPercentage()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsLengthPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 12995); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLengthPercentage()"
")"); do { *((volatile int*)__null) = 12995; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
12996 return length_percentage._0;
12997 }
12998
12999 static StyleGenericLengthPercentageOrAuto Auto() {
13000 StyleGenericLengthPercentageOrAuto result;
13001 result.tag = Tag::Auto;
13002 return result;
13003 }
13004
13005 bool IsAuto() const {
13006 return tag == Tag::Auto;
13007 }
13008
13009 bool operator==(const StyleGenericLengthPercentageOrAuto& other) const {
13010 if (tag != other.tag) {
13011 return false;
13012 }
13013 switch (tag) {
13014 case Tag::LengthPercentage: return length_percentage == other.length_percentage;
13015 default: break;
13016 }
13017 return true;
13018 }
13019
13020 bool operator!=(const StyleGenericLengthPercentageOrAuto& other) const {
13021 return !(*this == other);
13022 }
13023
13024 private:
13025 StyleGenericLengthPercentageOrAuto() {
13026
13027 }
13028 public:
13029
13030
13031 ~StyleGenericLengthPercentageOrAuto() {
13032 switch (tag) {
13033 case Tag::LengthPercentage: length_percentage.~StyleLengthPercentage_Body(); break;
13034 default: break;
13035 }
13036 }
13037
13038 StyleGenericLengthPercentageOrAuto(const StyleGenericLengthPercentageOrAuto& other)
13039 : tag(other.tag) {
13040 switch (tag) {
13041 case Tag::LengthPercentage: ::new (&length_percentage) (StyleLengthPercentage_Body)(other.length_percentage); break;
13042 default: break;
13043 }
13044 }
13045 StyleGenericLengthPercentageOrAuto& operator=(const StyleGenericLengthPercentageOrAuto& other) {
13046 if (this != &other) {
13047 this->~StyleGenericLengthPercentageOrAuto();
13048 new (this) StyleGenericLengthPercentageOrAuto(other);
13049 }
13050 return *this;
13051 }
13052 inline bool ConvertsToLength() const;
13053 inline nscoord ToLength() const;
13054 inline bool ConvertsToPercentage() const;
13055 inline float ToPercentage() const;
13056 inline bool HasPercent() const;
13057 inline bool HasLengthAndPercentage() const;
13058
13059 // Just some convenient aliases for LengthOrAuto, to avoid confusing naming.
13060 inline bool IsLength() const;
13061 inline const StyleLength& AsLength() const;
13062
13063 static inline StyleGenericLengthPercentageOrAuto Zero();
13064};
13065
13066/// A generic value for the `[ [ auto | <length-percentage> ]{1,2} ]`.
13067///
13068/// https://drafts.csswg.org/scroll-animations-1/#view-timeline-inset
13069template<typename LengthPercent>
13070struct StyleGenericViewTimelineInset {
13071 /// The start inset in the relevant axis.
13072 StyleGenericLengthPercentageOrAuto<LengthPercent> start;
13073 /// The end inset.
13074 StyleGenericLengthPercentageOrAuto<LengthPercent> end;
13075
13076 bool operator==(const StyleGenericViewTimelineInset& other) const {
13077 return start == other.start &&
13078 end == other.end;
13079 }
13080 bool operator!=(const StyleGenericViewTimelineInset& other) const {
13081 return start != other.start ||
13082 end != other.end;
13083 }
13084 public:
13085 inline StyleGenericViewTimelineInset();
13086};
13087
13088/// The view() notation.
13089/// https://drafts.csswg.org/scroll-animations-1/#view-notation
13090template<typename LengthPercent>
13091struct StyleGenericViewFunction {
13092 /// The axis of scrolling that drives the progress of the timeline.
13093 StyleScrollAxis axis;
13094 /// An adjustment of the view progress visibility range.
13095 StyleGenericViewTimelineInset<LengthPercent> inset;
13096
13097 bool operator==(const StyleGenericViewFunction& other) const {
13098 return axis == other.axis &&
13099 inset == other.inset;
13100 }
13101 bool operator!=(const StyleGenericViewFunction& other) const {
13102 return axis != other.axis ||
13103 inset != other.inset;
13104 }
13105};
13106
13107/// A value for the <single-animation-timeline>.
13108///
13109/// https://drafts.csswg.org/css-animations-2/#typedef-single-animation-timeline
13110template<typename LengthPercent>
13111struct StyleGenericAnimationTimeline {
13112 enum class Tag : uint8_t {
13113 /// Use default timeline. The animation’s timeline is a DocumentTimeline.
13114 Auto,
13115 /// The scroll-timeline name or view-timeline-name.
13116 /// This also includes `none` value by using an empty atom.
13117 /// https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-name
13118 /// https://drafts.csswg.org/scroll-animations-1/#view-timeline-name
13119 Timeline,
13120 /// The scroll() notation.
13121 /// https://drafts.csswg.org/scroll-animations-1/#scroll-notation
13122 Scroll,
13123 /// The view() notation.
13124 /// https://drafts.csswg.org/scroll-animations-1/#view-notation
13125 View,
13126 };
13127
13128 struct StyleTimeline_Body {
13129 StyleTimelineName _0;
13130
13131 bool operator==(const StyleTimeline_Body& other) const {
13132 return _0 == other._0;
13133 }
13134 bool operator!=(const StyleTimeline_Body& other) const {
13135 return _0 != other._0;
13136 }
13137 };
13138
13139 struct StyleScroll_Body {
13140 StyleScrollFunction _0;
13141
13142 bool operator==(const StyleScroll_Body& other) const {
13143 return _0 == other._0;
13144 }
13145 bool operator!=(const StyleScroll_Body& other) const {
13146 return _0 != other._0;
13147 }
13148 };
13149
13150 struct StyleView_Body {
13151 StyleGenericViewFunction<LengthPercent> _0;
13152
13153 bool operator==(const StyleView_Body& other) const {
13154 return _0 == other._0;
13155 }
13156 bool operator!=(const StyleView_Body& other) const {
13157 return _0 != other._0;
13158 }
13159 };
13160
13161 Tag tag;
13162 union {
13163 StyleTimeline_Body timeline;
13164 StyleScroll_Body scroll;
13165 StyleView_Body view;
13166 };
13167
13168 static StyleGenericAnimationTimeline Auto() {
13169 StyleGenericAnimationTimeline result;
13170 result.tag = Tag::Auto;
13171 return result;
13172 }
13173
13174 bool IsAuto() const {
13175 return tag == Tag::Auto;
13176 }
13177
13178 static StyleGenericAnimationTimeline Timeline(const StyleTimelineName &_0) {
13179 StyleGenericAnimationTimeline result;
13180 ::new (&result.timeline._0) (StyleTimelineName)(_0);
13181 result.tag = Tag::Timeline;
13182 return result;
13183 }
13184
13185 bool IsTimeline() const {
13186 return tag == Tag::Timeline;
13187 }
13188
13189 const StyleTimelineName& AsTimeline() const {
13190 MOZ_DIAGNOSTIC_ASSERT(IsTimeline())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTimeline())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTimeline()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsTimeline()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 13190); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTimeline()"
")"); do { *((volatile int*)__null) = 13190; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
13191 return timeline._0;
13192 }
13193
13194 static StyleGenericAnimationTimeline Scroll(const StyleScrollFunction &_0) {
13195 StyleGenericAnimationTimeline result;
13196 ::new (&result.scroll._0) (StyleScrollFunction)(_0);
13197 result.tag = Tag::Scroll;
13198 return result;
13199 }
13200
13201 bool IsScroll() const {
13202 return tag == Tag::Scroll;
13203 }
13204
13205 const StyleScrollFunction& AsScroll() const {
13206 MOZ_DIAGNOSTIC_ASSERT(IsScroll())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsScroll())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsScroll()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsScroll()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 13206); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsScroll()"
")"); do { *((volatile int*)__null) = 13206; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
13207 return scroll._0;
13208 }
13209
13210 static StyleGenericAnimationTimeline View(const StyleGenericViewFunction<LengthPercent> &_0) {
13211 StyleGenericAnimationTimeline result;
13212 ::new (&result.view._0) (StyleGenericViewFunction<LengthPercent>)(_0);
13213 result.tag = Tag::View;
13214 return result;
13215 }
13216
13217 bool IsView() const {
13218 return tag == Tag::View;
13219 }
13220
13221 const StyleGenericViewFunction<LengthPercent>& AsView() const {
13222 MOZ_DIAGNOSTIC_ASSERT(IsView())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsView())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsView()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsView()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 13222); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsView()"
")"); do { *((volatile int*)__null) = 13222; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
13223 return view._0;
13224 }
13225
13226 bool operator==(const StyleGenericAnimationTimeline& other) const {
13227 if (tag != other.tag) {
13228 return false;
13229 }
13230 switch (tag) {
13231 case Tag::Timeline: return timeline == other.timeline;
13232 case Tag::Scroll: return scroll == other.scroll;
13233 case Tag::View: return view == other.view;
13234 default: break;
13235 }
13236 return true;
13237 }
13238
13239 bool operator!=(const StyleGenericAnimationTimeline& other) const {
13240 return !(*this == other);
13241 }
13242
13243 private:
13244 StyleGenericAnimationTimeline() {
13245
13246 }
13247 public:
13248
13249
13250 ~StyleGenericAnimationTimeline() {
13251 switch (tag) {
13252 case Tag::Timeline: timeline.~StyleTimeline_Body(); break;
13253 case Tag::Scroll: scroll.~StyleScroll_Body(); break;
13254 case Tag::View: view.~StyleView_Body(); break;
13255 default: break;
13256 }
13257 }
13258
13259 StyleGenericAnimationTimeline(const StyleGenericAnimationTimeline& other)
13260 : tag(other.tag) {
13261 switch (tag) {
13262 case Tag::Timeline: ::new (&timeline) (StyleTimeline_Body)(other.timeline); break;
13263 case Tag::Scroll: ::new (&scroll) (StyleScroll_Body)(other.scroll); break;
13264 case Tag::View: ::new (&view) (StyleView_Body)(other.view); break;
13265 default: break;
13266 }
13267 }
13268 StyleGenericAnimationTimeline& operator=(const StyleGenericAnimationTimeline& other) {
13269 if (this != &other) {
13270 this->~StyleGenericAnimationTimeline();
13271 new (this) StyleGenericAnimationTimeline(other);
13272 }
13273 return *this;
13274 }
13275};
13276
13277/// A computed value for the `animation-timeline` property.
13278using StyleAnimationTimeline = StyleGenericAnimationTimeline<StyleLengthPercentage>;
13279
13280/// A computed value for the `animation-iteration-count` property.
13281struct StyleAnimationIterationCount {
13282 float _0;
13283
13284 bool operator==(const StyleAnimationIterationCount& other) const {
13285 return _0 == other._0;
13286 }
13287 bool operator!=(const StyleAnimationIterationCount& other) const {
13288 return _0 != other._0;
13289 }
13290};
13291
13292/// The `animation-duration` property.
13293///
13294/// https://drafts.csswg.org/css-animations-2/#animation-duration
13295template<typename T>
13296struct StyleGenericAnimationDuration {
13297 enum class Tag : uint8_t {
13298 /// The initial value. However, we serialize this as 0s if the preference is disabled.
13299 Auto,
13300 /// The time value, <time [0s,∞]>.
13301 Time,
13302 };
13303
13304 struct StyleTime_Body {
13305 T _0;
13306
13307 bool operator==(const StyleTime_Body& other) const {
13308 return _0 == other._0;
13309 }
13310 bool operator!=(const StyleTime_Body& other) const {
13311 return _0 != other._0;
13312 }
13313 };
13314
13315 Tag tag;
13316 union {
13317 StyleTime_Body time;
13318 };
13319
13320 static StyleGenericAnimationDuration Auto() {
13321 StyleGenericAnimationDuration result;
13322 result.tag = Tag::Auto;
13323 return result;
13324 }
13325
13326 bool IsAuto() const {
13327 return tag == Tag::Auto;
13328 }
13329
13330 static StyleGenericAnimationDuration Time(const T &_0) {
13331 StyleGenericAnimationDuration result;
13332 ::new (&result.time._0) (T)(_0);
13333 result.tag = Tag::Time;
13334 return result;
13335 }
13336
13337 bool IsTime() const {
13338 return tag == Tag::Time;
13339 }
13340
13341 const T& AsTime() const {
13342 MOZ_DIAGNOSTIC_ASSERT(IsTime())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTime())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTime()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsTime()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 13342); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTime()"
")"); do { *((volatile int*)__null) = 13342; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
13343 return time._0;
13344 }
13345
13346 bool operator==(const StyleGenericAnimationDuration& other) const {
13347 if (tag != other.tag) {
13348 return false;
13349 }
13350 switch (tag) {
13351 case Tag::Time: return time == other.time;
13352 default: break;
13353 }
13354 return true;
13355 }
13356
13357 bool operator!=(const StyleGenericAnimationDuration& other) const {
13358 return !(*this == other);
13359 }
13360
13361 private:
13362 StyleGenericAnimationDuration() {
13363
13364 }
13365 public:
13366
13367
13368 ~StyleGenericAnimationDuration() {
13369 switch (tag) {
13370 case Tag::Time: time.~StyleTime_Body(); break;
13371 default: break;
13372 }
13373 }
13374
13375 StyleGenericAnimationDuration(const StyleGenericAnimationDuration& other)
13376 : tag(other.tag) {
13377 switch (tag) {
13378 case Tag::Time: ::new (&time) (StyleTime_Body)(other.time); break;
13379 default: break;
13380 }
13381 }
13382 StyleGenericAnimationDuration& operator=(const StyleGenericAnimationDuration& other) {
13383 if (this != &other) {
13384 this->~StyleGenericAnimationDuration();
13385 new (this) StyleGenericAnimationDuration(other);
13386 }
13387 return *this;
13388 }
13389};
13390
13391/// A computed value for the `animation-duration` property.
13392using StyleAnimationDuration = StyleGenericAnimationDuration<StyleTime>;
13393
13394/// An App Unit, the fundamental unit of length in Servo. Usually
13395/// 1/60th of a pixel (see `AU_PER_PX`)
13396///
13397/// Please ensure that the values are between `MIN_AU` and `MAX_AU`.
13398/// It is safe to construct invalid `Au` values, but it may lead to
13399/// panics and overflows.
13400using StyleAu = int32_t;
13401
13402/// A generic value for the `border-spacing` property.
13403template<typename L>
13404using StyleGenericBorderSpacing = StyleSize2D<L>;
13405
13406/// A computed value for the `border-spacing` longhand property.
13407using StyleBorderSpacing = StyleGenericBorderSpacing<StyleNonNegativeLength>;
13408
13409/// Specified value of `-moz-force-broken-image-icon`
13410using StyleBoolInteger = bool;
13411
13412/// <https://drafts.csswg.org/css-ui/#propdef-outline-style>
13413struct StyleOutlineStyle {
13414 enum class Tag : uint8_t {
13415 /// auto
13416 Auto,
13417 /// <border-style>
13418 BorderStyle,
13419 };
13420
13421 struct StyleBorderStyle_Body {
13422 StyleBorderStyle _0;
13423
13424 bool operator==(const StyleBorderStyle_Body& other) const {
13425 return _0 == other._0;
13426 }
13427 bool operator!=(const StyleBorderStyle_Body& other) const {
13428 return _0 != other._0;
13429 }
13430 };
13431
13432 Tag tag;
13433 union {
13434 StyleBorderStyle_Body border_style;
13435 };
13436
13437 static StyleOutlineStyle Auto() {
13438 StyleOutlineStyle result;
13439 result.tag = Tag::Auto;
13440 return result;
13441 }
13442
13443 bool IsAuto() const {
13444 return tag == Tag::Auto;
13445 }
13446
13447 static StyleOutlineStyle BorderStyle(const StyleBorderStyle &_0) {
13448 StyleOutlineStyle result;
13449 ::new (&result.border_style._0) (StyleBorderStyle)(_0);
13450 result.tag = Tag::BorderStyle;
13451 return result;
13452 }
13453
13454 bool IsBorderStyle() const {
13455 return tag == Tag::BorderStyle;
13456 }
13457
13458 const StyleBorderStyle& AsBorderStyle() const {
13459 MOZ_DIAGNOSTIC_ASSERT(IsBorderStyle())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsBorderStyle())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsBorderStyle()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsBorderStyle()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 13459); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsBorderStyle()"
")"); do { *((volatile int*)__null) = 13459; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
13460 return border_style._0;
13461 }
13462
13463 bool operator==(const StyleOutlineStyle& other) const {
13464 if (tag != other.tag) {
13465 return false;
13466 }
13467 switch (tag) {
13468 case Tag::BorderStyle: return border_style == other.border_style;
13469 default: break;
13470 }
13471 return true;
13472 }
13473
13474 bool operator!=(const StyleOutlineStyle& other) const {
13475 return !(*this == other);
13476 }
13477
13478 private:
13479 StyleOutlineStyle() {
13480
13481 }
13482 public:
13483
13484
13485 ~StyleOutlineStyle() {
13486 switch (tag) {
13487 case Tag::BorderStyle: border_style.~StyleBorderStyle_Body(); break;
13488 default: break;
13489 }
13490 }
13491
13492 StyleOutlineStyle(const StyleOutlineStyle& other)
13493 : tag(other.tag) {
13494 switch (tag) {
13495 case Tag::BorderStyle: ::new (&border_style) (StyleBorderStyle_Body)(other.border_style); break;
13496 default: break;
13497 }
13498 }
13499 StyleOutlineStyle& operator=(const StyleOutlineStyle& other) {
13500 if (this != &other) {
13501 this->~StyleOutlineStyle();
13502 new (this) StyleOutlineStyle(other);
13503 }
13504 return *this;
13505 }
13506};
13507
13508/// A generic value for the `font-size-adjust` property.
13509///
13510/// https://drafts.csswg.org/css-fonts-5/#font-size-adjust-prop
13511template<typename Factor>
13512union StyleGenericFontSizeAdjust {
13513 enum class Tag : uint8_t {
13514 None,
13515 ExHeight,
13516 CapHeight,
13517 ChWidth,
13518 IcWidth,
13519 IcHeight,
13520 };
13521
13522 struct ExHeight_Body {
13523 Tag tag;
13524 Factor _0;
13525
13526 bool operator==(const ExHeight_Body& other) const {
13527 return _0 == other._0;
13528 }
13529 bool operator!=(const ExHeight_Body& other) const {
13530 return _0 != other._0;
13531 }
13532 };
13533
13534 struct CapHeight_Body {
13535 Tag tag;
13536 Factor _0;
13537
13538 bool operator==(const CapHeight_Body& other) const {
13539 return _0 == other._0;
13540 }
13541 bool operator!=(const CapHeight_Body& other) const {
13542 return _0 != other._0;
13543 }
13544 };
13545
13546 struct ChWidth_Body {
13547 Tag tag;
13548 Factor _0;
13549
13550 bool operator==(const ChWidth_Body& other) const {
13551 return _0 == other._0;
13552 }
13553 bool operator!=(const ChWidth_Body& other) const {
13554 return _0 != other._0;
13555 }
13556 };
13557
13558 struct IcWidth_Body {
13559 Tag tag;
13560 Factor _0;
13561
13562 bool operator==(const IcWidth_Body& other) const {
13563 return _0 == other._0;
13564 }
13565 bool operator!=(const IcWidth_Body& other) const {
13566 return _0 != other._0;
13567 }
13568 };
13569
13570 struct IcHeight_Body {
13571 Tag tag;
13572 Factor _0;
13573
13574 bool operator==(const IcHeight_Body& other) const {
13575 return _0 == other._0;
13576 }
13577 bool operator!=(const IcHeight_Body& other) const {
13578 return _0 != other._0;
13579 }
13580 };
13581
13582 struct {
13583 Tag tag;
13584 };
13585 ExHeight_Body ex_height;
13586 CapHeight_Body cap_height;
13587 ChWidth_Body ch_width;
13588 IcWidth_Body ic_width;
13589 IcHeight_Body ic_height;
13590
13591 static StyleGenericFontSizeAdjust None() {
13592 StyleGenericFontSizeAdjust result;
13593 result.tag = Tag::None;
13594 return result;
13595 }
13596
13597 bool IsNone() const {
13598 return tag == Tag::None;
13599 }
13600
13601 static StyleGenericFontSizeAdjust ExHeight(const Factor &_0) {
13602 StyleGenericFontSizeAdjust result;
13603 ::new (&result.ex_height._0) (Factor)(_0);
13604 result.tag = Tag::ExHeight;
13605 return result;
13606 }
13607
13608 bool IsExHeight() const {
13609 return tag == Tag::ExHeight;
13610 }
13611
13612 const Factor& AsExHeight() const {
13613 MOZ_DIAGNOSTIC_ASSERT(IsExHeight())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsExHeight())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsExHeight()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsExHeight()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 13613); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsExHeight()"
")"); do { *((volatile int*)__null) = 13613; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
13614 return ex_height._0;
13615 }
13616
13617 static StyleGenericFontSizeAdjust CapHeight(const Factor &_0) {
13618 StyleGenericFontSizeAdjust result;
13619 ::new (&result.cap_height._0) (Factor)(_0);
13620 result.tag = Tag::CapHeight;
13621 return result;
13622 }
13623
13624 bool IsCapHeight() const {
13625 return tag == Tag::CapHeight;
13626 }
13627
13628 const Factor& AsCapHeight() const {
13629 MOZ_DIAGNOSTIC_ASSERT(IsCapHeight())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCapHeight())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCapHeight()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsCapHeight()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 13629); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCapHeight()"
")"); do { *((volatile int*)__null) = 13629; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
13630 return cap_height._0;
13631 }
13632
13633 static StyleGenericFontSizeAdjust ChWidth(const Factor &_0) {
13634 StyleGenericFontSizeAdjust result;
13635 ::new (&result.ch_width._0) (Factor)(_0);
13636 result.tag = Tag::ChWidth;
13637 return result;
13638 }
13639
13640 bool IsChWidth() const {
13641 return tag == Tag::ChWidth;
13642 }
13643
13644 const Factor& AsChWidth() const {
13645 MOZ_DIAGNOSTIC_ASSERT(IsChWidth())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsChWidth())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsChWidth()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsChWidth()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 13645); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsChWidth()"
")"); do { *((volatile int*)__null) = 13645; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
13646 return ch_width._0;
13647 }
13648
13649 static StyleGenericFontSizeAdjust IcWidth(const Factor &_0) {
13650 StyleGenericFontSizeAdjust result;
13651 ::new (&result.ic_width._0) (Factor)(_0);
13652 result.tag = Tag::IcWidth;
13653 return result;
13654 }
13655
13656 bool IsIcWidth() const {
13657 return tag == Tag::IcWidth;
13658 }
13659
13660 const Factor& AsIcWidth() const {
13661 MOZ_DIAGNOSTIC_ASSERT(IsIcWidth())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsIcWidth())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsIcWidth()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsIcWidth()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 13661); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsIcWidth()"
")"); do { *((volatile int*)__null) = 13661; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
13662 return ic_width._0;
13663 }
13664
13665 static StyleGenericFontSizeAdjust IcHeight(const Factor &_0) {
13666 StyleGenericFontSizeAdjust result;
13667 ::new (&result.ic_height._0) (Factor)(_0);
13668 result.tag = Tag::IcHeight;
13669 return result;
13670 }
13671
13672 bool IsIcHeight() const {
13673 return tag == Tag::IcHeight;
13674 }
13675
13676 const Factor& AsIcHeight() const {
13677 MOZ_DIAGNOSTIC_ASSERT(IsIcHeight())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsIcHeight())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsIcHeight()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsIcHeight()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 13677); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsIcHeight()"
")"); do { *((volatile int*)__null) = 13677; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
13678 return ic_height._0;
13679 }
13680
13681 bool operator==(const StyleGenericFontSizeAdjust& other) const {
13682 if (tag != other.tag) {
13683 return false;
13684 }
13685 switch (tag) {
13686 case Tag::ExHeight: return ex_height == other.ex_height;
13687 case Tag::CapHeight: return cap_height == other.cap_height;
13688 case Tag::ChWidth: return ch_width == other.ch_width;
13689 case Tag::IcWidth: return ic_width == other.ic_width;
13690 case Tag::IcHeight: return ic_height == other.ic_height;
13691 default: break;
13692 }
13693 return true;
13694 }
13695
13696 bool operator!=(const StyleGenericFontSizeAdjust& other) const {
13697 return !(*this == other);
13698 }
13699
13700 private:
13701 StyleGenericFontSizeAdjust() {
13702
13703 }
13704 public:
13705
13706
13707 ~StyleGenericFontSizeAdjust() {
13708 switch (tag) {
13709 case Tag::ExHeight: ex_height.~ExHeight_Body(); break;
13710 case Tag::CapHeight: cap_height.~CapHeight_Body(); break;
13711 case Tag::ChWidth: ch_width.~ChWidth_Body(); break;
13712 case Tag::IcWidth: ic_width.~IcWidth_Body(); break;
13713 case Tag::IcHeight: ic_height.~IcHeight_Body(); break;
13714 default: break;
13715 }
13716 }
13717
13718 StyleGenericFontSizeAdjust(const StyleGenericFontSizeAdjust& other)
13719 : tag(other.tag) {
13720 switch (tag) {
13721 case Tag::ExHeight: ::new (&ex_height) (ExHeight_Body)(other.ex_height); break;
13722 case Tag::CapHeight: ::new (&cap_height) (CapHeight_Body)(other.cap_height); break;
13723 case Tag::ChWidth: ::new (&ch_width) (ChWidth_Body)(other.ch_width); break;
13724 case Tag::IcWidth: ::new (&ic_width) (IcWidth_Body)(other.ic_width); break;
13725 case Tag::IcHeight: ::new (&ic_height) (IcHeight_Body)(other.ic_height); break;
13726 default: break;
13727 }
13728 }
13729 StyleGenericFontSizeAdjust& operator=(const StyleGenericFontSizeAdjust& other) {
13730 if (this != &other) {
13731 this->~StyleGenericFontSizeAdjust();
13732 new (this) StyleGenericFontSizeAdjust(other);
13733 }
13734 return *this;
13735 }
13736};
13737
13738/// Preserve the readability of text when font fallback occurs.
13739using StyleFontSizeAdjust = StyleGenericFontSizeAdjust<StyleNonNegativeNumber>;
13740
13741/// Allows authors to choose a palette from those supported by a color font
13742/// (and potentially @font-palette-values overrides).
13743struct StyleFontPalette {
13744 StyleAtom _0;
13745
13746 bool operator==(const StyleFontPalette& other) const {
13747 return _0 == other._0;
13748 }
13749 bool operator!=(const StyleFontPalette& other) const {
13750 return _0 != other._0;
13751 }
13752 inline static StyleFontPalette Normal() {
13753 return StyleFontPalette{StyleAtom(nsGkAtoms::normal->ToAddRefed())};
13754 }
13755};
13756
13757/// Variants for east asian variant
13758struct StyleFontVariantEastAsian {
13759 uint16_t _0;
13760
13761 constexpr explicit operator bool() const {
13762 return !!_0;
13763 }
13764 constexpr StyleFontVariantEastAsian operator~() const {
13765 return StyleFontVariantEastAsian { static_cast<decltype(_0)>(~_0) };
13766 }
13767 constexpr StyleFontVariantEastAsian operator|(const StyleFontVariantEastAsian& other) const {
13768 return StyleFontVariantEastAsian { static_cast<decltype(_0)>(this->_0 | other._0) };
13769 }
13770 StyleFontVariantEastAsian& operator|=(const StyleFontVariantEastAsian& other) {
13771 *this = (*this | other);
13772 return *this;
13773 }
13774 constexpr StyleFontVariantEastAsian operator&(const StyleFontVariantEastAsian& other) const {
13775 return StyleFontVariantEastAsian { static_cast<decltype(_0)>(this->_0 & other._0) };
13776 }
13777 StyleFontVariantEastAsian& operator&=(const StyleFontVariantEastAsian& other) {
13778 *this = (*this & other);
13779 return *this;
13780 }
13781 constexpr StyleFontVariantEastAsian operator^(const StyleFontVariantEastAsian& other) const {
13782 return StyleFontVariantEastAsian { static_cast<decltype(_0)>(this->_0 ^ other._0) };
13783 }
13784 StyleFontVariantEastAsian& operator^=(const StyleFontVariantEastAsian& other) {
13785 *this = (*this ^ other);
13786 return *this;
13787 }
13788 bool operator==(const StyleFontVariantEastAsian& other) const {
13789 return _0 == other._0;
13790 }
13791 bool operator!=(const StyleFontVariantEastAsian& other) const {
13792 return _0 != other._0;
13793 }
13794 static const StyleFontVariantEastAsian NORMAL;
13795 static const StyleFontVariantEastAsian JIS78;
13796 static const StyleFontVariantEastAsian JIS83;
13797 static const StyleFontVariantEastAsian JIS90;
13798 static const StyleFontVariantEastAsian JIS04;
13799 static const StyleFontVariantEastAsian SIMPLIFIED;
13800 static const StyleFontVariantEastAsian TRADITIONAL;
13801 static const StyleFontVariantEastAsian JIS_GROUP;
13802 static const StyleFontVariantEastAsian FULL_WIDTH;
13803 static const StyleFontVariantEastAsian PROPORTIONAL_WIDTH;
13804 static const StyleFontVariantEastAsian RUBY;
13805 static const uintptr_t COUNT;
13806};
13807/// None of the features
13808constexpr inline const StyleFontVariantEastAsian StyleFontVariantEastAsian::NORMAL = StyleFontVariantEastAsian{ /* ._0 = */ (uint16_t)0 };
13809/// Enables rendering of JIS78 forms (OpenType feature: jp78)
13810constexpr inline const StyleFontVariantEastAsian StyleFontVariantEastAsian::JIS78 = StyleFontVariantEastAsian{ /* ._0 = */ (uint16_t)(1 << 0) };
13811/// Enables rendering of JIS83 forms (OpenType feature: jp83).
13812constexpr inline const StyleFontVariantEastAsian StyleFontVariantEastAsian::JIS83 = StyleFontVariantEastAsian{ /* ._0 = */ (uint16_t)(1 << 1) };
13813/// Enables rendering of JIS90 forms (OpenType feature: jp90).
13814constexpr inline const StyleFontVariantEastAsian StyleFontVariantEastAsian::JIS90 = StyleFontVariantEastAsian{ /* ._0 = */ (uint16_t)(1 << 2) };
13815/// Enables rendering of JIS2004 forms (OpenType feature: jp04).
13816constexpr inline const StyleFontVariantEastAsian StyleFontVariantEastAsian::JIS04 = StyleFontVariantEastAsian{ /* ._0 = */ (uint16_t)(1 << 3) };
13817/// Enables rendering of simplified forms (OpenType feature: smpl).
13818constexpr inline const StyleFontVariantEastAsian StyleFontVariantEastAsian::SIMPLIFIED = StyleFontVariantEastAsian{ /* ._0 = */ (uint16_t)(1 << 4) };
13819/// Enables rendering of traditional forms (OpenType feature: trad).
13820constexpr inline const StyleFontVariantEastAsian StyleFontVariantEastAsian::TRADITIONAL = StyleFontVariantEastAsian{ /* ._0 = */ (uint16_t)(1 << 5) };
13821/// These values are exclusive with each other.
13822constexpr inline const StyleFontVariantEastAsian StyleFontVariantEastAsian::JIS_GROUP = StyleFontVariantEastAsian{ /* ._0 = */ (uint16_t)((((((StyleFontVariantEastAsian::JIS78)._0 | (StyleFontVariantEastAsian::JIS83)._0) | (StyleFontVariantEastAsian::JIS90)._0) | (StyleFontVariantEastAsian::JIS04)._0) | (StyleFontVariantEastAsian::SIMPLIFIED)._0) | (StyleFontVariantEastAsian::TRADITIONAL)._0) };
13823/// Enables rendering of full-width variants (OpenType feature: fwid).
13824constexpr inline const StyleFontVariantEastAsian StyleFontVariantEastAsian::FULL_WIDTH = StyleFontVariantEastAsian{ /* ._0 = */ (uint16_t)(1 << 6) };
13825/// Enables rendering of proportionally-spaced variants (OpenType feature: pwid).
13826constexpr inline const StyleFontVariantEastAsian StyleFontVariantEastAsian::PROPORTIONAL_WIDTH = StyleFontVariantEastAsian{ /* ._0 = */ (uint16_t)(1 << 7) };
13827/// Enables display of ruby variant glyphs (OpenType feature: ruby).
13828constexpr inline const StyleFontVariantEastAsian StyleFontVariantEastAsian::RUBY = StyleFontVariantEastAsian{ /* ._0 = */ (uint16_t)(1 << 8) };
13829/// The number of variants.
13830constexpr inline const uintptr_t StyleFontVariantEastAsian::COUNT = 9;
13831
13832/// Variants of ligatures
13833struct StyleFontVariantLigatures {
13834 uint16_t _0;
13835
13836 constexpr explicit operator bool() const {
13837 return !!_0;
13838 }
13839 constexpr StyleFontVariantLigatures operator~() const {
13840 return StyleFontVariantLigatures { static_cast<decltype(_0)>(~_0) };
13841 }
13842 constexpr StyleFontVariantLigatures operator|(const StyleFontVariantLigatures& other) const {
13843 return StyleFontVariantLigatures { static_cast<decltype(_0)>(this->_0 | other._0) };
13844 }
13845 StyleFontVariantLigatures& operator|=(const StyleFontVariantLigatures& other) {
13846 *this = (*this | other);
13847 return *this;
13848 }
13849 constexpr StyleFontVariantLigatures operator&(const StyleFontVariantLigatures& other) const {
13850 return StyleFontVariantLigatures { static_cast<decltype(_0)>(this->_0 & other._0) };
13851 }
13852 StyleFontVariantLigatures& operator&=(const StyleFontVariantLigatures& other) {
13853 *this = (*this & other);
13854 return *this;
13855 }
13856 constexpr StyleFontVariantLigatures operator^(const StyleFontVariantLigatures& other) const {
13857 return StyleFontVariantLigatures { static_cast<decltype(_0)>(this->_0 ^ other._0) };
13858 }
13859 StyleFontVariantLigatures& operator^=(const StyleFontVariantLigatures& other) {
13860 *this = (*this ^ other);
13861 return *this;
13862 }
13863 bool operator==(const StyleFontVariantLigatures& other) const {
13864 return _0 == other._0;
13865 }
13866 bool operator!=(const StyleFontVariantLigatures& other) const {
13867 return _0 != other._0;
13868 }
13869 static const StyleFontVariantLigatures NORMAL;
13870 static const StyleFontVariantLigatures NONE;
13871 static const StyleFontVariantLigatures COMMON_LIGATURES;
13872 static const StyleFontVariantLigatures NO_COMMON_LIGATURES;
13873 static const StyleFontVariantLigatures DISCRETIONARY_LIGATURES;
13874 static const StyleFontVariantLigatures NO_DISCRETIONARY_LIGATURES;
13875 static const StyleFontVariantLigatures HISTORICAL_LIGATURES;
13876 static const StyleFontVariantLigatures NO_HISTORICAL_LIGATURES;
13877 static const StyleFontVariantLigatures CONTEXTUAL;
13878 static const StyleFontVariantLigatures NO_CONTEXTUAL;
13879 static const uintptr_t COUNT;
13880};
13881/// Specifies that common default features are enabled
13882constexpr inline const StyleFontVariantLigatures StyleFontVariantLigatures::NORMAL = StyleFontVariantLigatures{ /* ._0 = */ (uint16_t)0 };
13883/// Specifies that no features are enabled;
13884constexpr inline const StyleFontVariantLigatures StyleFontVariantLigatures::NONE = StyleFontVariantLigatures{ /* ._0 = */ (uint16_t)1 };
13885/// Enables display of common ligatures
13886constexpr inline const StyleFontVariantLigatures StyleFontVariantLigatures::COMMON_LIGATURES = StyleFontVariantLigatures{ /* ._0 = */ (uint16_t)(1 << 1) };
13887/// Disables display of common ligatures
13888constexpr inline const StyleFontVariantLigatures StyleFontVariantLigatures::NO_COMMON_LIGATURES = StyleFontVariantLigatures{ /* ._0 = */ (uint16_t)(1 << 2) };
13889/// Enables display of discretionary ligatures
13890constexpr inline const StyleFontVariantLigatures StyleFontVariantLigatures::DISCRETIONARY_LIGATURES = StyleFontVariantLigatures{ /* ._0 = */ (uint16_t)(1 << 3) };
13891/// Disables display of discretionary ligatures
13892constexpr inline const StyleFontVariantLigatures StyleFontVariantLigatures::NO_DISCRETIONARY_LIGATURES = StyleFontVariantLigatures{ /* ._0 = */ (uint16_t)(1 << 4) };
13893/// Enables display of historical ligatures
13894constexpr inline const StyleFontVariantLigatures StyleFontVariantLigatures::HISTORICAL_LIGATURES = StyleFontVariantLigatures{ /* ._0 = */ (uint16_t)(1 << 5) };
13895/// Disables display of historical ligatures
13896constexpr inline const StyleFontVariantLigatures StyleFontVariantLigatures::NO_HISTORICAL_LIGATURES = StyleFontVariantLigatures{ /* ._0 = */ (uint16_t)(1 << 6) };
13897/// Enables display of contextual alternates
13898constexpr inline const StyleFontVariantLigatures StyleFontVariantLigatures::CONTEXTUAL = StyleFontVariantLigatures{ /* ._0 = */ (uint16_t)(1 << 7) };
13899/// Disables display of contextual alternates
13900constexpr inline const StyleFontVariantLigatures StyleFontVariantLigatures::NO_CONTEXTUAL = StyleFontVariantLigatures{ /* ._0 = */ (uint16_t)(1 << 8) };
13901/// The number of variants.
13902constexpr inline const uintptr_t StyleFontVariantLigatures::COUNT = 9;
13903
13904/// Variants of numeric values
13905struct StyleFontVariantNumeric {
13906 uint8_t _0;
13907
13908 constexpr explicit operator bool() const {
13909 return !!_0;
13910 }
13911 constexpr StyleFontVariantNumeric operator~() const {
13912 return StyleFontVariantNumeric { static_cast<decltype(_0)>(~_0) };
13913 }
13914 constexpr StyleFontVariantNumeric operator|(const StyleFontVariantNumeric& other) const {
13915 return StyleFontVariantNumeric { static_cast<decltype(_0)>(this->_0 | other._0) };
13916 }
13917 StyleFontVariantNumeric& operator|=(const StyleFontVariantNumeric& other) {
13918 *this = (*this | other);
13919 return *this;
13920 }
13921 constexpr StyleFontVariantNumeric operator&(const StyleFontVariantNumeric& other) const {
13922 return StyleFontVariantNumeric { static_cast<decltype(_0)>(this->_0 & other._0) };
13923 }
13924 StyleFontVariantNumeric& operator&=(const StyleFontVariantNumeric& other) {
13925 *this = (*this & other);
13926 return *this;
13927 }
13928 constexpr StyleFontVariantNumeric operator^(const StyleFontVariantNumeric& other) const {
13929 return StyleFontVariantNumeric { static_cast<decltype(_0)>(this->_0 ^ other._0) };
13930 }
13931 StyleFontVariantNumeric& operator^=(const StyleFontVariantNumeric& other) {
13932 *this = (*this ^ other);
13933 return *this;
13934 }
13935 bool operator==(const StyleFontVariantNumeric& other) const {
13936 return _0 == other._0;
13937 }
13938 bool operator!=(const StyleFontVariantNumeric& other) const {
13939 return _0 != other._0;
13940 }
13941 static const StyleFontVariantNumeric NORMAL;
13942 static const StyleFontVariantNumeric LINING_NUMS;
13943 static const StyleFontVariantNumeric OLDSTYLE_NUMS;
13944 static const StyleFontVariantNumeric PROPORTIONAL_NUMS;
13945 static const StyleFontVariantNumeric TABULAR_NUMS;
13946 static const StyleFontVariantNumeric DIAGONAL_FRACTIONS;
13947 static const StyleFontVariantNumeric STACKED_FRACTIONS;
13948 static const StyleFontVariantNumeric SLASHED_ZERO;
13949 static const StyleFontVariantNumeric ORDINAL;
13950 static const uintptr_t COUNT;
13951};
13952/// Specifies that common default features are enabled
13953constexpr inline const StyleFontVariantNumeric StyleFontVariantNumeric::NORMAL = StyleFontVariantNumeric{ /* ._0 = */ (uint8_t)0 };
13954/// Enables display of lining numerals.
13955constexpr inline const StyleFontVariantNumeric StyleFontVariantNumeric::LINING_NUMS = StyleFontVariantNumeric{ /* ._0 = */ (uint8_t)(1 << 0) };
13956/// Enables display of old-style numerals.
13957constexpr inline const StyleFontVariantNumeric StyleFontVariantNumeric::OLDSTYLE_NUMS = StyleFontVariantNumeric{ /* ._0 = */ (uint8_t)(1 << 1) };
13958/// Enables display of proportional numerals.
13959constexpr inline const StyleFontVariantNumeric StyleFontVariantNumeric::PROPORTIONAL_NUMS = StyleFontVariantNumeric{ /* ._0 = */ (uint8_t)(1 << 2) };
13960/// Enables display of tabular numerals.
13961constexpr inline const StyleFontVariantNumeric StyleFontVariantNumeric::TABULAR_NUMS = StyleFontVariantNumeric{ /* ._0 = */ (uint8_t)(1 << 3) };
13962/// Enables display of lining diagonal fractions.
13963constexpr inline const StyleFontVariantNumeric StyleFontVariantNumeric::DIAGONAL_FRACTIONS = StyleFontVariantNumeric{ /* ._0 = */ (uint8_t)(1 << 4) };
13964/// Enables display of lining stacked fractions.
13965constexpr inline const StyleFontVariantNumeric StyleFontVariantNumeric::STACKED_FRACTIONS = StyleFontVariantNumeric{ /* ._0 = */ (uint8_t)(1 << 5) };
13966/// Enables display of slashed zeros.
13967constexpr inline const StyleFontVariantNumeric StyleFontVariantNumeric::SLASHED_ZERO = StyleFontVariantNumeric{ /* ._0 = */ (uint8_t)(1 << 6) };
13968/// Enables display of letter forms used with ordinal numbers.
13969constexpr inline const StyleFontVariantNumeric StyleFontVariantNumeric::ORDINAL = StyleFontVariantNumeric{ /* ._0 = */ (uint8_t)(1 << 7) };
13970/// The number of variants.
13971constexpr inline const uintptr_t StyleFontVariantNumeric::COUNT = 8;
13972
13973/// Misc information about a given computed style.
13974///
13975/// All flags are currently inherited for text, pseudo elements, and
13976/// anonymous boxes, see StyleBuilder::for_inheritance and its callsites.
13977/// If we ever want to add some flags that shouldn't inherit for them,
13978/// we might want to add a function to handle this.
13979struct StyleComputedValueFlags {
13980 uint32_t _0;
13981
13982 constexpr explicit operator bool() const {
13983 return !!_0;
13984 }
13985 constexpr StyleComputedValueFlags operator~() const {
13986 return StyleComputedValueFlags { static_cast<decltype(_0)>(~_0) };
13987 }
13988 constexpr StyleComputedValueFlags operator|(const StyleComputedValueFlags& other) const {
13989 return StyleComputedValueFlags { static_cast<decltype(_0)>(this->_0 | other._0) };
13990 }
13991 StyleComputedValueFlags& operator|=(const StyleComputedValueFlags& other) {
13992 *this = (*this | other);
13993 return *this;
13994 }
13995 constexpr StyleComputedValueFlags operator&(const StyleComputedValueFlags& other) const {
13996 return StyleComputedValueFlags { static_cast<decltype(_0)>(this->_0 & other._0) };
13997 }
13998 StyleComputedValueFlags& operator&=(const StyleComputedValueFlags& other) {
13999 *this = (*this & other);
14000 return *this;
14001 }
14002 constexpr StyleComputedValueFlags operator^(const StyleComputedValueFlags& other) const {
14003 return StyleComputedValueFlags { static_cast<decltype(_0)>(this->_0 ^ other._0) };
14004 }
14005 StyleComputedValueFlags& operator^=(const StyleComputedValueFlags& other) {
14006 *this = (*this ^ other);
14007 return *this;
14008 }
14009 bool operator==(const StyleComputedValueFlags& other) const {
14010 return _0 == other._0;
14011 }
14012 bool operator!=(const StyleComputedValueFlags& other) const {
14013 return _0 != other._0;
14014 }
14015 static const StyleComputedValueFlags HAS_TEXT_DECORATION_LINES;
14016 static const StyleComputedValueFlags SHOULD_SUPPRESS_LINEBREAK;
14017 static const StyleComputedValueFlags IS_TEXT_COMBINED;
14018 static const StyleComputedValueFlags IS_RELEVANT_LINK_VISITED;
14019 static const StyleComputedValueFlags IS_IN_PSEUDO_ELEMENT_SUBTREE;
14020 static const StyleComputedValueFlags SELF_OR_ANCESTOR_HAS_CONTAIN_STYLE;
14021 static const StyleComputedValueFlags DISPLAY_DEPENDS_ON_INHERITED_STYLE;
14022 static const StyleComputedValueFlags CONTENT_DEPENDS_ON_INHERITED_STYLE;
14023 static const StyleComputedValueFlags INHERITS_RESET_STYLE;
14024 static const StyleComputedValueFlags DEPENDS_ON_SELF_FONT_METRICS;
14025 static const StyleComputedValueFlags DEPENDS_ON_INHERITED_FONT_METRICS;
14026 static const StyleComputedValueFlags CAN_BE_FRAGMENTED;
14027 static const StyleComputedValueFlags IS_ROOT_ELEMENT_STYLE;
14028 static const StyleComputedValueFlags IS_IN_OPACITY_ZERO_SUBTREE;
14029 static const StyleComputedValueFlags HAS_AUTHOR_SPECIFIED_BORDER_BACKGROUND;
14030 static const StyleComputedValueFlags HAS_AUTHOR_SPECIFIED_FONT_FAMILY;
14031 static const StyleComputedValueFlags HAS_AUTHOR_SPECIFIED_FONT_SYNTHESIS_WEIGHT;
14032 static const StyleComputedValueFlags HAS_AUTHOR_SPECIFIED_FONT_SYNTHESIS_STYLE;
14033 static const StyleComputedValueFlags HAS_AUTHOR_SPECIFIED_LETTER_SPACING;
14034 static const StyleComputedValueFlags HAS_AUTHOR_SPECIFIED_WORD_SPACING;
14035 static const StyleComputedValueFlags USES_VIEWPORT_UNITS;
14036 static const StyleComputedValueFlags USES_VIEWPORT_UNITS_ON_CONTAINER_QUERIES;
14037 static const StyleComputedValueFlags SELF_OR_ANCESTOR_HAS_SIZE_CONTAINER_TYPE;
14038 static const StyleComputedValueFlags USES_CONTAINER_UNITS;
14039 static const StyleComputedValueFlags HAS_AUTHOR_SPECIFIED_TEXT_COLOR;
14040 static const StyleComputedValueFlags CONSIDERED_NONTRIVIAL_SCOPED_STYLE;
14041};
14042/// Whether the style or any of the ancestors has a text-decoration-line
14043/// property that should get propagated to descendants.
14044///
14045/// text-decoration-line is a reset property, but gets propagated in the
14046/// frame/box tree.
14047constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::HAS_TEXT_DECORATION_LINES = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 0) };
14048/// Whether line break inside should be suppressed.
14049///
14050/// If this flag is set, the line should not be broken inside,
14051/// which means inlines act as if nowrap is set, <br> element is
14052/// suppressed, and blocks are inlinized.
14053///
14054/// This bit is propagated to all children of line participants.
14055/// It is currently used by ruby to make its content unbreakable.
14056constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::SHOULD_SUPPRESS_LINEBREAK = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 1) };
14057/// A flag used to mark text that that has text-combine-upright.
14058///
14059/// This is used from Gecko's layout engine.
14060constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::IS_TEXT_COMBINED = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 2) };
14061/// A flag used to mark styles under a relevant link that is also
14062/// visited.
14063constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::IS_RELEVANT_LINK_VISITED = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 3) };
14064/// A flag used to mark styles which are a pseudo-element or under one.
14065constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::IS_IN_PSEUDO_ELEMENT_SUBTREE = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 4) };
14066/// A flag used to mark styles which have contain:style or under one.
14067constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::SELF_OR_ANCESTOR_HAS_CONTAIN_STYLE = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 5) };
14068/// Whether this style's `display` property depends on our parent style.
14069///
14070/// This is important because it may affect our optimizations to avoid
14071/// computing the style of pseudo-elements, given whether the
14072/// pseudo-element is generated depends on the `display` value.
14073constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::DISPLAY_DEPENDS_ON_INHERITED_STYLE = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 6) };
14074/// Whether this style's `content` depends on our parent style.
14075///
14076/// Important because of the same reason.
14077constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::CONTENT_DEPENDS_ON_INHERITED_STYLE = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 7) };
14078/// Whether the child explicitly inherits any reset property.
14079constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::INHERITS_RESET_STYLE = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 8) };
14080/// Whether any value on our style is font-metric-dependent on our
14081/// primary font.
14082constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::DEPENDS_ON_SELF_FONT_METRICS = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 9) };
14083/// Whether any value on our style is font-metric-dependent on the
14084/// primary font of our parent.
14085constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::DEPENDS_ON_INHERITED_FONT_METRICS = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 10) };
14086/// Whether the style or any of the ancestors has a multicol style.
14087///
14088/// Only used in Servo.
14089constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::CAN_BE_FRAGMENTED = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 11) };
14090/// Whether this style is the style of the document element.
14091constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::IS_ROOT_ELEMENT_STYLE = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 12) };
14092/// Whether this element is inside an `opacity: 0` subtree.
14093constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::IS_IN_OPACITY_ZERO_SUBTREE = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 13) };
14094/// Whether there are author-specified rules for border-* properties
14095/// (except border-image-*), background-color, or background-image.
14096///
14097/// TODO(emilio): Maybe do include border-image, see:
14098///
14099/// https://github.com/w3c/csswg-drafts/issues/4777#issuecomment-604424845
14100constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::HAS_AUTHOR_SPECIFIED_BORDER_BACKGROUND = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 14) };
14101/// Whether there are author-specified rules for `font-family`.
14102constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::HAS_AUTHOR_SPECIFIED_FONT_FAMILY = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 16) };
14103/// Whether there are author-specified rules for `font-synthesis-weight`.
14104constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::HAS_AUTHOR_SPECIFIED_FONT_SYNTHESIS_WEIGHT = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 17) };
14105/// Whether there are author-specified rules for `font-synthesis-style`.
14106constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::HAS_AUTHOR_SPECIFIED_FONT_SYNTHESIS_STYLE = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 18) };
14107/// Whether there are author-specified rules for `letter-spacing`.
14108constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::HAS_AUTHOR_SPECIFIED_LETTER_SPACING = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 19) };
14109/// Whether there are author-specified rules for `word-spacing`.
14110constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::HAS_AUTHOR_SPECIFIED_WORD_SPACING = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 20) };
14111/// Whether the style depends on viewport units.
14112constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::USES_VIEWPORT_UNITS = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 21) };
14113/// Whether the style depends on viewport units on container queries.
14114///
14115/// This needs to be a separate flag from `USES_VIEWPORT_UNITS` because
14116/// it causes us to re-match the style (rather than re-cascascading it,
14117/// which is enough for other uses of viewport units).
14118constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::USES_VIEWPORT_UNITS_ON_CONTAINER_QUERIES = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 22) };
14119/// A flag used to mark styles which have `container-type` of `size` or
14120/// `inline-size`, or under one.
14121constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::SELF_OR_ANCESTOR_HAS_SIZE_CONTAINER_TYPE = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 23) };
14122/// Whether the style uses container query units, in which case the style depends on the
14123/// container's size and we can't reuse it across cousins (without double-checking the
14124/// container at least).
14125constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::USES_CONTAINER_UNITS = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 24) };
14126/// Whether there are author-specific rules for text `color`.
14127constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::HAS_AUTHOR_SPECIFIED_TEXT_COLOR = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 25) };
14128/// Whether this style considered a scope style rule.
14129constexpr inline const StyleComputedValueFlags StyleComputedValueFlags::CONSIDERED_NONTRIVIAL_SCOPED_STYLE = StyleComputedValueFlags{ /* ._0 = */ (uint32_t)(1 << 26) };
14130
14131struct StyleDisplay {
14132 uint16_t _0;
14133
14134 bool operator==(const StyleDisplay& other) const {
14135 return _0 == other._0;
14136 }
14137 bool operator!=(const StyleDisplay& other) const {
14138 return _0 != other._0;
14139 }
14140 inline StyleDisplayOutside Outside() const;
14141 inline StyleDisplayInside Inside() const;
14142 inline bool IsListItem() const;
14143 inline bool IsInlineFlow() const;
14144 inline bool IsInlineInside() const;
14145 inline bool IsInlineOutside() const;
14146 inline bool IsBlockOutside() const;
14147 inline bool IsRuby() const;
14148 inline bool IsInternalRuby() const;
14149 inline bool IsInternalTable() const;
14150 inline bool IsInternalTableExceptCell() const;
14151 static const uint16_t LIST_ITEM_MASK;
14152 static const uint16_t OUTSIDE_MASK;
14153 static const uint16_t INSIDE_MASK;
14154 static const uint16_t OUTSIDE_SHIFT;
14155 static const StyleDisplay None;
14156 static const StyleDisplay Contents;
14157 static const StyleDisplay Inline;
14158 static const StyleDisplay InlineBlock;
14159 static const StyleDisplay Block;
14160 static const StyleDisplay FlowRoot;
14161 static const StyleDisplay Flex;
14162 static const StyleDisplay InlineFlex;
14163 static const StyleDisplay Grid;
14164 static const StyleDisplay InlineGrid;
14165 static const StyleDisplay Table;
14166 static const StyleDisplay InlineTable;
14167 static const StyleDisplay TableCaption;
14168 static const StyleDisplay Ruby;
14169 static const StyleDisplay WebkitBox;
14170 static const StyleDisplay WebkitInlineBox;
14171 static const StyleDisplay TableRowGroup;
14172 static const StyleDisplay TableHeaderGroup;
14173 static const StyleDisplay TableFooterGroup;
14174 static const StyleDisplay TableColumn;
14175 static const StyleDisplay TableColumnGroup;
14176 static const StyleDisplay TableRow;
14177 static const StyleDisplay TableCell;
14178 static const StyleDisplay RubyBase;
14179 static const StyleDisplay RubyBaseContainer;
14180 static const StyleDisplay RubyText;
14181 static const StyleDisplay RubyTextContainer;
14182};
14183constexpr inline const uint16_t StyleDisplay::LIST_ITEM_MASK = 32768;
14184constexpr inline const uint16_t StyleDisplay::OUTSIDE_MASK = 32512;
14185constexpr inline const uint16_t StyleDisplay::INSIDE_MASK = 255;
14186constexpr inline const uint16_t StyleDisplay::OUTSIDE_SHIFT = 8;
14187/// https://drafts.csswg.org/css-display/#the-display-properties
14188/// ::new() inlined so cbindgen can use it
14189constexpr inline const StyleDisplay StyleDisplay::None = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::None << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::None) };
14190constexpr inline const StyleDisplay StyleDisplay::Contents = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::None << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::Contents) };
14191constexpr inline const StyleDisplay StyleDisplay::Inline = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Inline << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::Flow) };
14192constexpr inline const StyleDisplay StyleDisplay::InlineBlock = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Inline << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::FlowRoot) };
14193constexpr inline const StyleDisplay StyleDisplay::Block = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Block << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::Flow) };
14194#if defined(CBINDGEN_IS_GECKO)
14195constexpr inline const StyleDisplay StyleDisplay::FlowRoot = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Block << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::FlowRoot) };
14196#endif
14197constexpr inline const StyleDisplay StyleDisplay::Flex = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Block << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::Flex) };
14198constexpr inline const StyleDisplay StyleDisplay::InlineFlex = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Inline << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::Flex) };
14199constexpr inline const StyleDisplay StyleDisplay::Grid = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Block << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::Grid) };
14200constexpr inline const StyleDisplay StyleDisplay::InlineGrid = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Inline << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::Grid) };
14201constexpr inline const StyleDisplay StyleDisplay::Table = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Block << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::Table) };
14202constexpr inline const StyleDisplay StyleDisplay::InlineTable = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Inline << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::Table) };
14203constexpr inline const StyleDisplay StyleDisplay::TableCaption = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::TableCaption << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::Flow) };
14204#if defined(CBINDGEN_IS_GECKO)
14205constexpr inline const StyleDisplay StyleDisplay::Ruby = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Inline << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::Ruby) };
14206#endif
14207#if defined(CBINDGEN_IS_GECKO)
14208constexpr inline const StyleDisplay StyleDisplay::WebkitBox = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Block << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::WebkitBox) };
14209#endif
14210#if defined(CBINDGEN_IS_GECKO)
14211constexpr inline const StyleDisplay StyleDisplay::WebkitInlineBox = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::Inline << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::WebkitBox) };
14212#endif
14213constexpr inline const StyleDisplay StyleDisplay::TableRowGroup = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::InternalTable << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::TableRowGroup) };
14214constexpr inline const StyleDisplay StyleDisplay::TableHeaderGroup = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::InternalTable << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::TableHeaderGroup) };
14215constexpr inline const StyleDisplay StyleDisplay::TableFooterGroup = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::InternalTable << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::TableFooterGroup) };
14216constexpr inline const StyleDisplay StyleDisplay::TableColumn = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::InternalTable << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::TableColumn) };
14217constexpr inline const StyleDisplay StyleDisplay::TableColumnGroup = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::InternalTable << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::TableColumnGroup) };
14218constexpr inline const StyleDisplay StyleDisplay::TableRow = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::InternalTable << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::TableRow) };
14219constexpr inline const StyleDisplay StyleDisplay::TableCell = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::InternalTable << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::TableCell) };
14220#if defined(CBINDGEN_IS_GECKO)
14221/// Internal ruby boxes.
14222constexpr inline const StyleDisplay StyleDisplay::RubyBase = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::InternalRuby << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::RubyBase) };
14223#endif
14224#if defined(CBINDGEN_IS_GECKO)
14225constexpr inline const StyleDisplay StyleDisplay::RubyBaseContainer = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::InternalRuby << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::RubyBaseContainer) };
14226#endif
14227#if defined(CBINDGEN_IS_GECKO)
14228constexpr inline const StyleDisplay StyleDisplay::RubyText = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::InternalRuby << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::RubyText) };
14229#endif
14230#if defined(CBINDGEN_IS_GECKO)
14231constexpr inline const StyleDisplay StyleDisplay::RubyTextContainer = StyleDisplay{ /* ._0 = */ (((uint16_t)StyleDisplayOutside::InternalRuby << StyleDisplay::OUTSIDE_SHIFT) | (uint16_t)StyleDisplayInside::RubyTextContainer) };
14232#endif
14233
14234/// https://drafts.csswg.org/css-anchor-position-1/#propdef-position-anchor
14235union StylePositionAnchor {
14236 enum class Tag : uint8_t {
14237 /// `auto`
14238 Auto,
14239 /// `<dashed-ident>`
14240 Ident,
14241 };
14242
14243 struct Ident_Body {
14244 Tag tag;
14245 StyleDashedIdent _0;
14246
14247 bool operator==(const Ident_Body& other) const {
14248 return _0 == other._0;
14249 }
14250 bool operator!=(const Ident_Body& other) const {
14251 return _0 != other._0;
14252 }
14253 };
14254
14255 struct {
14256 Tag tag;
14257 };
14258 Ident_Body ident;
14259
14260 static StylePositionAnchor Auto() {
14261 StylePositionAnchor result;
14262 result.tag = Tag::Auto;
14263 return result;
14264 }
14265
14266 bool IsAuto() const {
14267 return tag == Tag::Auto;
14268 }
14269
14270 static StylePositionAnchor Ident(const StyleDashedIdent &_0) {
14271 StylePositionAnchor result;
14272 ::new (&result.ident._0) (StyleDashedIdent)(_0);
14273 result.tag = Tag::Ident;
14274 return result;
14275 }
14276
14277 bool IsIdent() const {
14278 return tag == Tag::Ident;
14279 }
14280
14281 const StyleDashedIdent& AsIdent() const {
14282 MOZ_DIAGNOSTIC_ASSERT(IsIdent())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsIdent())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsIdent()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsIdent()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 14282); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsIdent()"
")"); do { *((volatile int*)__null) = 14282; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
14283 return ident._0;
14284 }
14285
14286 bool operator==(const StylePositionAnchor& other) const {
14287 if (tag != other.tag) {
14288 return false;
14289 }
14290 switch (tag) {
14291 case Tag::Ident: return ident == other.ident;
14292 default: break;
14293 }
14294 return true;
14295 }
14296
14297 bool operator!=(const StylePositionAnchor& other) const {
14298 return !(*this == other);
14299 }
14300
14301 private:
14302 StylePositionAnchor() {
14303
14304 }
14305 public:
14306
14307
14308 ~StylePositionAnchor() {
14309 switch (tag) {
14310 case Tag::Ident: ident.~Ident_Body(); break;
14311 default: break;
14312 }
14313 }
14314
14315 StylePositionAnchor(const StylePositionAnchor& other)
14316 : tag(other.tag) {
14317 switch (tag) {
14318 case Tag::Ident: ::new (&ident) (Ident_Body)(other.ident); break;
14319 default: break;
14320 }
14321 }
14322 StylePositionAnchor& operator=(const StylePositionAnchor& other) {
14323 if (this != &other) {
14324 this->~StylePositionAnchor();
14325 new (this) StylePositionAnchor(other);
14326 }
14327 return *this;
14328 }
14329};
14330
14331/// https://drafts.csswg.org/css-anchor-position-1/#propdef-position-area
14332struct StylePositionArea {
14333 /// First keyword, if any.
14334 StylePositionAreaKeyword first;
14335 /// Second keyword, if any.
14336 StylePositionAreaKeyword second;
14337
14338 bool operator==(const StylePositionArea& other) const {
14339 return first == other.first &&
14340 second == other.second;
14341 }
14342 bool operator!=(const StylePositionArea& other) const {
14343 return first != other.first ||
14344 second != other.second;
14345 }
14346};
14347
14348/// Changes for the automatically-generated position option.
14349/// Note that this is order-dependent - e.g. `flip-start flip-inline` != `flip-inline flip-start`.
14350///
14351/// https://drafts.csswg.org/css-anchor-position-1/#typedef-position-try-fallbacks-try-tactic
14352struct StylePositionTryFallbacksTryTactic {
14353 StylePositionTryFallbacksTryTacticKeyword _0;
14354 StylePositionTryFallbacksTryTacticKeyword _1;
14355 StylePositionTryFallbacksTryTacticKeyword _2;
14356
14357 bool operator==(const StylePositionTryFallbacksTryTactic& other) const {
14358 return _0 == other._0 &&
14359 _1 == other._1 &&
14360 _2 == other._2;
14361 }
14362 bool operator!=(const StylePositionTryFallbacksTryTactic& other) const {
14363 return _0 != other._0 ||
14364 _1 != other._1 ||
14365 _2 != other._2;
14366 }
14367};
14368
14369/// https://drafts.csswg.org/css-anchor-position-1/#propdef-position-try-fallbacks
14370/// <dashed-ident> || <try-tactic>
14371struct StyleDashedIdentAndOrTryTactic {
14372 /// `<dashed-ident>`
14373 StyleDashedIdent ident;
14374 /// `<try-tactic>`
14375 StylePositionTryFallbacksTryTactic try_tactic;
14376
14377 bool operator==(const StyleDashedIdentAndOrTryTactic& other) const {
14378 return ident == other.ident &&
14379 try_tactic == other.try_tactic;
14380 }
14381 bool operator!=(const StyleDashedIdentAndOrTryTactic& other) const {
14382 return ident != other.ident ||
14383 try_tactic != other.try_tactic;
14384 }
14385};
14386
14387/// https://drafts.csswg.org/css-anchor-position-1/#propdef-position-try-fallbacks
14388/// [ [<dashed-ident> || <try-tactic>] | <'position-area'> ]
14389union StylePositionTryFallbacksItem {
14390 enum class Tag : uint8_t {
14391 /// `<dashed-ident> || <try-tactic>`
14392 IdentAndOrTactic,
14393 /// `<position-area>`
14394 PositionArea,
14395 };
14396
14397 struct IdentAndOrTactic_Body {
14398 Tag tag;
14399 StyleDashedIdentAndOrTryTactic _0;
14400
14401 bool operator==(const IdentAndOrTactic_Body& other) const {
14402 return _0 == other._0;
14403 }
14404 bool operator!=(const IdentAndOrTactic_Body& other) const {
14405 return _0 != other._0;
14406 }
14407 };
14408
14409 struct PositionArea_Body {
14410 Tag tag;
14411 StylePositionArea _0;
14412
14413 bool operator==(const PositionArea_Body& other) const {
14414 return _0 == other._0;
14415 }
14416 bool operator!=(const PositionArea_Body& other) const {
14417 return _0 != other._0;
14418 }
14419 };
14420
14421 struct {
14422 Tag tag;
14423 };
14424 IdentAndOrTactic_Body ident_and_or_tactic;
14425 PositionArea_Body position_area;
14426
14427 static StylePositionTryFallbacksItem IdentAndOrTactic(const StyleDashedIdentAndOrTryTactic &_0) {
14428 StylePositionTryFallbacksItem result;
14429 ::new (&result.ident_and_or_tactic._0) (StyleDashedIdentAndOrTryTactic)(_0);
14430 result.tag = Tag::IdentAndOrTactic;
14431 return result;
14432 }
14433
14434 bool IsIdentAndOrTactic() const {
14435 return tag == Tag::IdentAndOrTactic;
14436 }
14437
14438 const StyleDashedIdentAndOrTryTactic& AsIdentAndOrTactic() const {
14439 MOZ_DIAGNOSTIC_ASSERT(IsIdentAndOrTactic())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsIdentAndOrTactic())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsIdentAndOrTactic()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsIdentAndOrTactic()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 14439); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsIdentAndOrTactic()"
")"); do { *((volatile int*)__null) = 14439; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
14440 return ident_and_or_tactic._0;
14441 }
14442
14443 static StylePositionTryFallbacksItem PositionArea(const StylePositionArea &_0) {
14444 StylePositionTryFallbacksItem result;
14445 ::new (&result.position_area._0) (StylePositionArea)(_0);
14446 result.tag = Tag::PositionArea;
14447 return result;
14448 }
14449
14450 bool IsPositionArea() const {
14451 return tag == Tag::PositionArea;
14452 }
14453
14454 const StylePositionArea& AsPositionArea() const {
14455 MOZ_DIAGNOSTIC_ASSERT(IsPositionArea())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPositionArea())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPositionArea()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPositionArea()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 14455); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPositionArea()"
")"); do { *((volatile int*)__null) = 14455; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
14456 return position_area._0;
14457 }
14458
14459 bool operator==(const StylePositionTryFallbacksItem& other) const {
14460 if (tag != other.tag) {
14461 return false;
14462 }
14463 switch (tag) {
14464 case Tag::IdentAndOrTactic: return ident_and_or_tactic == other.ident_and_or_tactic;
14465 case Tag::PositionArea: return position_area == other.position_area;
14466
14467 }
14468 return true;
14469 }
14470
14471 bool operator!=(const StylePositionTryFallbacksItem& other) const {
14472 return !(*this == other);
14473 }
14474
14475 private:
14476 StylePositionTryFallbacksItem() {
14477
14478 }
14479 public:
14480
14481
14482 ~StylePositionTryFallbacksItem() {
14483 switch (tag) {
14484 case Tag::IdentAndOrTactic: ident_and_or_tactic.~IdentAndOrTactic_Body(); break;
14485 case Tag::PositionArea: position_area.~PositionArea_Body(); break;
14486
14487 }
14488 }
14489
14490 StylePositionTryFallbacksItem(const StylePositionTryFallbacksItem& other)
14491 : tag(other.tag) {
14492 switch (tag) {
14493 case Tag::IdentAndOrTactic: ::new (&ident_and_or_tactic) (IdentAndOrTactic_Body)(other.ident_and_or_tactic); break;
14494 case Tag::PositionArea: ::new (&position_area) (PositionArea_Body)(other.position_area); break;
14495
14496 }
14497 }
14498 StylePositionTryFallbacksItem& operator=(const StylePositionTryFallbacksItem& other) {
14499 if (this != &other) {
14500 this->~StylePositionTryFallbacksItem();
14501 new (this) StylePositionTryFallbacksItem(other);
14502 }
14503 return *this;
14504 }
14505};
14506
14507/// https://drafts.csswg.org/css-anchor-position-1/#position-try-fallbacks
14508struct StylePositionTryFallbacks {
14509 StyleArcSlice<StylePositionTryFallbacksItem> _0;
14510
14511 bool operator==(const StylePositionTryFallbacks& other) const {
14512 return _0 == other._0;
14513 }
14514 bool operator!=(const StylePositionTryFallbacks& other) const {
14515 return _0 != other._0;
14516 }
14517};
14518
14519/// Specified keyword values for the position-visibility property.
14520struct StylePositionVisibility {
14521 uint8_t _0;
14522
14523 constexpr explicit operator bool() const {
14524 return !!_0;
14525 }
14526 constexpr StylePositionVisibility operator~() const {
14527 return StylePositionVisibility { static_cast<decltype(_0)>(~_0) };
14528 }
14529 constexpr StylePositionVisibility operator|(const StylePositionVisibility& other) const {
14530 return StylePositionVisibility { static_cast<decltype(_0)>(this->_0 | other._0) };
14531 }
14532 StylePositionVisibility& operator|=(const StylePositionVisibility& other) {
14533 *this = (*this | other);
14534 return *this;
14535 }
14536 constexpr StylePositionVisibility operator&(const StylePositionVisibility& other) const {
14537 return StylePositionVisibility { static_cast<decltype(_0)>(this->_0 & other._0) };
14538 }
14539 StylePositionVisibility& operator&=(const StylePositionVisibility& other) {
14540 *this = (*this & other);
14541 return *this;
14542 }
14543 constexpr StylePositionVisibility operator^(const StylePositionVisibility& other) const {
14544 return StylePositionVisibility { static_cast<decltype(_0)>(this->_0 ^ other._0) };
14545 }
14546 StylePositionVisibility& operator^=(const StylePositionVisibility& other) {
14547 *this = (*this ^ other);
14548 return *this;
14549 }
14550 bool operator==(const StylePositionVisibility& other) const {
14551 return _0 == other._0;
14552 }
14553 bool operator!=(const StylePositionVisibility& other) const {
14554 return _0 != other._0;
14555 }
14556 static const StylePositionVisibility ALWAYS;
14557 static const StylePositionVisibility ANCHORS_VALID;
14558 static const StylePositionVisibility ANCHORS_VISIBLE;
14559 static const StylePositionVisibility NO_OVERFLOW;
14560};
14561/// Element is displayed without regard for its anchors or its overflowing status.
14562constexpr inline const StylePositionVisibility StylePositionVisibility::ALWAYS = StylePositionVisibility{ /* ._0 = */ (uint8_t)0 };
14563/// anchors-valid
14564constexpr inline const StylePositionVisibility StylePositionVisibility::ANCHORS_VALID = StylePositionVisibility{ /* ._0 = */ (uint8_t)(1 << 0) };
14565/// anchors-visible
14566constexpr inline const StylePositionVisibility StylePositionVisibility::ANCHORS_VISIBLE = StylePositionVisibility{ /* ._0 = */ (uint8_t)(1 << 1) };
14567/// no-overflow
14568constexpr inline const StylePositionVisibility StylePositionVisibility::NO_OVERFLOW = StylePositionVisibility{ /* ._0 = */ (uint8_t)(1 << 2) };
14569
14570/// https://drafts.csswg.org/css-scroll-snap-1/#scroll-snap-align
14571struct StyleScrollSnapAlign {
14572 StyleScrollSnapAlignKeyword block;
14573 StyleScrollSnapAlignKeyword inline_;
14574
14575 bool operator==(const StyleScrollSnapAlign& other) const {
14576 return block == other.block &&
14577 inline_ == other.inline_;
14578 }
14579 bool operator!=(const StyleScrollSnapAlign& other) const {
14580 return block != other.block ||
14581 inline_ != other.inline_;
14582 }
14583};
14584
14585/// https://drafts.csswg.org/css-scroll-snap-1/#scroll-snap-type
14586struct StyleScrollSnapType {
14587 StyleScrollSnapAxis axis;
14588 StyleScrollSnapStrictness strictness;
14589
14590 bool operator==(const StyleScrollSnapType& other) const {
14591 return axis == other.axis &&
14592 strictness == other.strictness;
14593 }
14594 bool operator!=(const StyleScrollSnapType& other) const {
14595 return axis != other.axis ||
14596 strictness != other.strictness;
14597 }
14598};
14599
14600/// A computed value for the `view-timeline-inset` property.
14601using StyleViewTimelineInset = StyleGenericViewTimelineInset<StyleLengthPercentage>;
14602
14603/// A computed value for the `letter-spacing` property.
14604template<typename L>
14605using StyleGenericLetterSpacing = L;
14606
14607/// This is generic just to make the #[derive()] code do the right thing for lengths.
14608using StyleLetterSpacing = StyleGenericLetterSpacing<StyleLengthPercentage>;
14609
14610/// A computed type for `<length-percentage> | auto`.
14611using StyleLengthPercentageOrAuto = StyleGenericLengthPercentageOrAuto<StyleLengthPercentage>;
14612
14613/// A generic value for the `line-height` property.
14614template<typename N, typename L>
14615struct StyleGenericLineHeight {
14616 enum class Tag : uint8_t {
14617 /// `normal`
14618 Normal,
14619#if defined(CBINDGEN_IS_GECKO)
14620 /// `-moz-block-height`
14621 MozBlockHeight,
14622#endif
14623 /// `<number>`
14624 Number,
14625 /// `<length-percentage>`
14626 Length,
14627 };
14628
14629 struct StyleNumber_Body {
14630 N _0;
14631
14632 bool operator==(const StyleNumber_Body& other) const {
14633 return _0 == other._0;
14634 }
14635 bool operator!=(const StyleNumber_Body& other) const {
14636 return _0 != other._0;
14637 }
14638 };
14639
14640 struct StyleLength_Body {
14641 L _0;
14642
14643 bool operator==(const StyleLength_Body& other) const {
14644 return _0 == other._0;
14645 }
14646 bool operator!=(const StyleLength_Body& other) const {
14647 return _0 != other._0;
14648 }
14649 };
14650
14651 Tag tag;
14652 union {
14653 StyleNumber_Body number;
14654 StyleLength_Body length;
14655 };
14656
14657 static StyleGenericLineHeight Normal() {
14658 StyleGenericLineHeight result;
14659 result.tag = Tag::Normal;
14660 return result;
14661 }
14662
14663 bool IsNormal() const {
14664 return tag == Tag::Normal;
14665 }
14666
14667#if defined(CBINDGEN_IS_GECKO)
14668 static StyleGenericLineHeight MozBlockHeight() {
14669 StyleGenericLineHeight result;
14670 result.tag = Tag::MozBlockHeight;
14671 return result;
14672 }
14673
14674 bool IsMozBlockHeight() const {
14675 return tag == Tag::MozBlockHeight;
14676 }
14677#endif
14678
14679 static StyleGenericLineHeight Number(const N &_0) {
14680 StyleGenericLineHeight result;
14681 ::new (&result.number._0) (N)(_0);
14682 result.tag = Tag::Number;
14683 return result;
14684 }
14685
14686 bool IsNumber() const {
14687 return tag == Tag::Number;
14688 }
14689
14690 const N& AsNumber() const {
14691 MOZ_DIAGNOSTIC_ASSERT(IsNumber())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsNumber())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsNumber()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsNumber()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 14691); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsNumber()"
")"); do { *((volatile int*)__null) = 14691; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
14692 return number._0;
14693 }
14694
14695 static StyleGenericLineHeight Length(const L &_0) {
14696 StyleGenericLineHeight result;
14697 ::new (&result.length._0) (L)(_0);
14698 result.tag = Tag::Length;
14699 return result;
14700 }
14701
14702 bool IsLength() const {
14703 return tag == Tag::Length;
14704 }
14705
14706 const L& AsLength() const {
14707 MOZ_DIAGNOSTIC_ASSERT(IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLength()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 14707); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLength()"
")"); do { *((volatile int*)__null) = 14707; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
14708 return length._0;
14709 }
14710
14711 bool operator==(const StyleGenericLineHeight& other) const {
14712 if (tag != other.tag) {
14713 return false;
14714 }
14715 switch (tag) {
14716 case Tag::Number: return number == other.number;
14717 case Tag::Length: return length == other.length;
14718 default: break;
14719 }
14720 return true;
14721 }
14722
14723 bool operator!=(const StyleGenericLineHeight& other) const {
14724 return !(*this == other);
14725 }
14726
14727 private:
14728 StyleGenericLineHeight() {
14729
14730 }
14731 public:
14732
14733
14734 ~StyleGenericLineHeight() {
14735 switch (tag) {
14736 case Tag::Number: number.~StyleNumber_Body(); break;
14737 case Tag::Length: length.~StyleLength_Body(); break;
14738 default: break;
14739 }
14740 }
14741
14742 StyleGenericLineHeight(const StyleGenericLineHeight& other)
14743 : tag(other.tag) {
14744 switch (tag) {
14745 case Tag::Number: ::new (&number) (StyleNumber_Body)(other.number); break;
14746 case Tag::Length: ::new (&length) (StyleLength_Body)(other.length); break;
14747 default: break;
14748 }
14749 }
14750 StyleGenericLineHeight& operator=(const StyleGenericLineHeight& other) {
14751 if (this != &other) {
14752 this->~StyleGenericLineHeight();
14753 new (this) StyleGenericLineHeight(other);
14754 }
14755 return *this;
14756 }
14757};
14758
14759/// A computed value for the `line-height` property.
14760using StyleLineHeight = StyleGenericLineHeight<StyleNonNegativeNumber, StyleNonNegativeLength>;
14761
14762/// A wrapper of LengthPercentageOrAuto, whose value must be >= 0.
14763using StyleNonNegativeLengthPercentageOrAuto = StyleGenericLengthPercentageOrAuto<StyleNonNegativeLengthPercentage>;
14764
14765/// A generic `<length-percentage>` | normal` value.
14766template<typename LengthPercent>
14767struct StyleGenericLengthPercentageOrNormal {
14768 enum class Tag : uint8_t {
14769 LengthPercentage,
14770 Normal,
14771 };
14772
14773 struct StyleLengthPercentage_Body {
14774 LengthPercent _0;
14775
14776 bool operator==(const StyleLengthPercentage_Body& other) const {
14777 return _0 == other._0;
14778 }
14779 bool operator!=(const StyleLengthPercentage_Body& other) const {
14780 return _0 != other._0;
14781 }
14782 };
14783
14784 Tag tag;
14785 union {
14786 StyleLengthPercentage_Body length_percentage;
14787 };
14788
14789 static StyleGenericLengthPercentageOrNormal LengthPercentage(const LengthPercent &_0) {
14790 StyleGenericLengthPercentageOrNormal result;
14791 ::new (&result.length_percentage._0) (LengthPercent)(_0);
14792 result.tag = Tag::LengthPercentage;
14793 return result;
14794 }
14795
14796 bool IsLengthPercentage() const {
14797 return tag == Tag::LengthPercentage;
14798 }
14799
14800 const LengthPercent& AsLengthPercentage() const {
14801 MOZ_DIAGNOSTIC_ASSERT(IsLengthPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLengthPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLengthPercentage()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsLengthPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 14801); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLengthPercentage()"
")"); do { *((volatile int*)__null) = 14801; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
14802 return length_percentage._0;
14803 }
14804
14805 static StyleGenericLengthPercentageOrNormal Normal() {
14806 StyleGenericLengthPercentageOrNormal result;
14807 result.tag = Tag::Normal;
14808 return result;
14809 }
14810
14811 bool IsNormal() const {
14812 return tag == Tag::Normal;
14813 }
14814
14815 bool operator==(const StyleGenericLengthPercentageOrNormal& other) const {
14816 if (tag != other.tag) {
14817 return false;
14818 }
14819 switch (tag) {
14820 case Tag::LengthPercentage: return length_percentage == other.length_percentage;
14821 default: break;
14822 }
14823 return true;
14824 }
14825
14826 bool operator!=(const StyleGenericLengthPercentageOrNormal& other) const {
14827 return !(*this == other);
14828 }
14829
14830 private:
14831 StyleGenericLengthPercentageOrNormal() {
14832
14833 }
14834 public:
14835
14836
14837 ~StyleGenericLengthPercentageOrNormal() {
14838 switch (tag) {
14839 case Tag::LengthPercentage: length_percentage.~StyleLengthPercentage_Body(); break;
14840 default: break;
14841 }
14842 }
14843
14844 StyleGenericLengthPercentageOrNormal(const StyleGenericLengthPercentageOrNormal& other)
14845 : tag(other.tag) {
14846 switch (tag) {
14847 case Tag::LengthPercentage: ::new (&length_percentage) (StyleLengthPercentage_Body)(other.length_percentage); break;
14848 default: break;
14849 }
14850 }
14851 StyleGenericLengthPercentageOrNormal& operator=(const StyleGenericLengthPercentageOrNormal& other) {
14852 if (this != &other) {
14853 this->~StyleGenericLengthPercentageOrNormal();
14854 new (this) StyleGenericLengthPercentageOrNormal(other);
14855 }
14856 return *this;
14857 }
14858};
14859
14860/// Either a computed NonNegativeLengthPercentage or the `normal` keyword.
14861using StyleNonNegativeLengthPercentageOrNormal = StyleGenericLengthPercentageOrNormal<StyleNonNegativeLengthPercentage>;
14862
14863/// Either a computed `<length>` or the `auto` keyword.
14864using StyleLengthOrAuto = StyleGenericLengthPercentageOrAuto<StyleLength>;
14865
14866/// Either a non-negative `<length>` or the `auto` keyword.
14867using StyleNonNegativeLengthOrAuto = StyleGenericLengthPercentageOrAuto<StyleNonNegativeLength>;
14868
14869/// Implements type for text-decoration-thickness
14870/// which takes the grammar of auto | from-font | <length> | <percentage>
14871///
14872/// https://drafts.csswg.org/css-text-decor-4/
14873template<typename L>
14874struct StyleGenericTextDecorationLength {
14875 enum class Tag : uint8_t {
14876 LengthPercentage,
14877 Auto,
14878 FromFont,
14879 };
14880
14881 struct StyleLengthPercentage_Body {
14882 L _0;
14883
14884 bool operator==(const StyleLengthPercentage_Body& other) const {
14885 return _0 == other._0;
14886 }
14887 bool operator!=(const StyleLengthPercentage_Body& other) const {
14888 return _0 != other._0;
14889 }
14890 };
14891
14892 Tag tag;
14893 union {
14894 StyleLengthPercentage_Body length_percentage;
14895 };
14896
14897 static StyleGenericTextDecorationLength LengthPercentage(const L &_0) {
14898 StyleGenericTextDecorationLength result;
14899 ::new (&result.length_percentage._0) (L)(_0);
14900 result.tag = Tag::LengthPercentage;
14901 return result;
14902 }
14903
14904 bool IsLengthPercentage() const {
14905 return tag == Tag::LengthPercentage;
14906 }
14907
14908 const L& AsLengthPercentage() const {
14909 MOZ_DIAGNOSTIC_ASSERT(IsLengthPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLengthPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLengthPercentage()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsLengthPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 14909); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLengthPercentage()"
")"); do { *((volatile int*)__null) = 14909; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
14910 return length_percentage._0;
14911 }
14912
14913 static StyleGenericTextDecorationLength Auto() {
14914 StyleGenericTextDecorationLength result;
14915 result.tag = Tag::Auto;
14916 return result;
14917 }
14918
14919 bool IsAuto() const {
14920 return tag == Tag::Auto;
14921 }
14922
14923 static StyleGenericTextDecorationLength FromFont() {
14924 StyleGenericTextDecorationLength result;
14925 result.tag = Tag::FromFont;
14926 return result;
14927 }
14928
14929 bool IsFromFont() const {
14930 return tag == Tag::FromFont;
14931 }
14932
14933 bool operator==(const StyleGenericTextDecorationLength& other) const {
14934 if (tag != other.tag) {
14935 return false;
14936 }
14937 switch (tag) {
14938 case Tag::LengthPercentage: return length_percentage == other.length_percentage;
14939 default: break;
14940 }
14941 return true;
14942 }
14943
14944 bool operator!=(const StyleGenericTextDecorationLength& other) const {
14945 return !(*this == other);
14946 }
14947
14948 private:
14949 StyleGenericTextDecorationLength() {
14950
14951 }
14952 public:
14953
14954
14955 ~StyleGenericTextDecorationLength() {
14956 switch (tag) {
14957 case Tag::LengthPercentage: length_percentage.~StyleLengthPercentage_Body(); break;
14958 default: break;
14959 }
14960 }
14961
14962 StyleGenericTextDecorationLength(const StyleGenericTextDecorationLength& other)
14963 : tag(other.tag) {
14964 switch (tag) {
14965 case Tag::LengthPercentage: ::new (&length_percentage) (StyleLengthPercentage_Body)(other.length_percentage); break;
14966 default: break;
14967 }
14968 }
14969 StyleGenericTextDecorationLength& operator=(const StyleGenericTextDecorationLength& other) {
14970 if (this != &other) {
14971 this->~StyleGenericTextDecorationLength();
14972 new (this) StyleGenericTextDecorationLength(other);
14973 }
14974 return *this;
14975 }
14976};
14977
14978/// Implements type for `text-decoration-thickness` property.
14979using StyleTextDecorationLength = StyleGenericTextDecorationLength<StyleLengthPercentage>;
14980
14981/// A generic value for the `initial-letter` property.
14982template<typename Number, typename Integer>
14983struct StyleGenericInitialLetter {
14984 /// The size, >=1, or 0 if `normal`.
14985 Number size;
14986 /// The sink, >=1, if specified, 0 otherwise.
14987 Integer sink;
14988
14989 bool operator==(const StyleGenericInitialLetter& other) const {
14990 return size == other.size &&
14991 sink == other.sink;
14992 }
14993 bool operator!=(const StyleGenericInitialLetter& other) const {
14994 return size != other.size ||
14995 sink != other.sink;
14996 }
14997};
14998
14999/// A computed value for the `initial-letter` property.
15000using StyleInitialLetter = StyleGenericInitialLetter<StyleCSSFloat, StyleCSSInteger>;
15001
15002/// A generic value for the `width`, `height`, `min-width`, or `min-height` property.
15003///
15004/// Unlike `max-width` or `max-height` properties, a Size can be `auto`,
15005/// and cannot be `none`.
15006///
15007/// Note that it only accepts non-negative values.
15008template<typename LengthPercent>
15009struct StyleGenericSize {
15010 enum class Tag : uint8_t {
15011 LengthPercentage,
15012 Auto,
15013#if defined(CBINDGEN_IS_GECKO)
15014 MaxContent,
15015#endif
15016#if defined(CBINDGEN_IS_GECKO)
15017 MinContent,
15018#endif
15019#if defined(CBINDGEN_IS_GECKO)
15020 FitContent,
15021#endif
15022#if defined(CBINDGEN_IS_GECKO)
15023 MozAvailable,
15024#endif
15025#if defined(CBINDGEN_IS_GECKO)
15026 WebkitFillAvailable,
15027#endif
15028 Stretch,
15029 FitContentFunction,
15030 AnchorSizeFunction,
15031 };
15032
15033 struct StyleLengthPercentage_Body {
15034 LengthPercent _0;
15035
15036 bool operator==(const StyleLengthPercentage_Body& other) const {
15037 return _0 == other._0;
15038 }
15039 bool operator!=(const StyleLengthPercentage_Body& other) const {
15040 return _0 != other._0;
15041 }
15042 };
15043
15044 struct StyleFitContentFunction_Body {
15045 LengthPercent _0;
15046
15047 bool operator==(const StyleFitContentFunction_Body& other) const {
15048 return _0 == other._0;
15049 }
15050 bool operator!=(const StyleFitContentFunction_Body& other) const {
15051 return _0 != other._0;
15052 }
15053 };
15054
15055 struct StyleAnchorSizeFunction_Body {
15056 StyleBox<StyleGenericAnchorSizeFunction<LengthPercent>> _0;
15057
15058 bool operator==(const StyleAnchorSizeFunction_Body& other) const {
15059 return _0 == other._0;
15060 }
15061 bool operator!=(const StyleAnchorSizeFunction_Body& other) const {
15062 return _0 != other._0;
15063 }
15064 };
15065
15066 Tag tag;
15067 union {
15068 StyleLengthPercentage_Body length_percentage;
15069 StyleFitContentFunction_Body fit_content_function;
15070 StyleAnchorSizeFunction_Body anchor_size_function;
15071 };
15072
15073 static StyleGenericSize LengthPercentage(const LengthPercent &_0) {
15074 StyleGenericSize result;
15075 ::new (&result.length_percentage._0) (LengthPercent)(_0);
15076 result.tag = Tag::LengthPercentage;
15077 return result;
15078 }
15079
15080 bool IsLengthPercentage() const {
15081 return tag == Tag::LengthPercentage;
15082 }
15083
15084 const LengthPercent& AsLengthPercentage() const {
15085 MOZ_DIAGNOSTIC_ASSERT(IsLengthPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLengthPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLengthPercentage()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsLengthPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 15085); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLengthPercentage()"
")"); do { *((volatile int*)__null) = 15085; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
15086 return length_percentage._0;
15087 }
15088
15089 static StyleGenericSize Auto() {
15090 StyleGenericSize result;
15091 result.tag = Tag::Auto;
15092 return result;
15093 }
15094
15095 bool IsAuto() const {
15096 return tag == Tag::Auto;
15097 }
15098
15099#if defined(CBINDGEN_IS_GECKO)
15100 static StyleGenericSize MaxContent() {
15101 StyleGenericSize result;
15102 result.tag = Tag::MaxContent;
15103 return result;
15104 }
15105
15106 bool IsMaxContent() const {
15107 return tag == Tag::MaxContent;
15108 }
15109#endif
15110
15111#if defined(CBINDGEN_IS_GECKO)
15112 static StyleGenericSize MinContent() {
15113 StyleGenericSize result;
15114 result.tag = Tag::MinContent;
15115 return result;
15116 }
15117
15118 bool IsMinContent() const {
15119 return tag == Tag::MinContent;
15120 }
15121#endif
15122
15123#if defined(CBINDGEN_IS_GECKO)
15124 static StyleGenericSize FitContent() {
15125 StyleGenericSize result;
15126 result.tag = Tag::FitContent;
15127 return result;
15128 }
15129
15130 bool IsFitContent() const {
15131 return tag == Tag::FitContent;
15132 }
15133#endif
15134
15135#if defined(CBINDGEN_IS_GECKO)
15136 static StyleGenericSize MozAvailable() {
15137 StyleGenericSize result;
15138 result.tag = Tag::MozAvailable;
15139 return result;
15140 }
15141
15142 bool IsMozAvailable() const {
15143 return tag == Tag::MozAvailable;
15144 }
15145#endif
15146
15147#if defined(CBINDGEN_IS_GECKO)
15148 static StyleGenericSize WebkitFillAvailable() {
15149 StyleGenericSize result;
15150 result.tag = Tag::WebkitFillAvailable;
15151 return result;
15152 }
15153
15154 bool IsWebkitFillAvailable() const {
15155 return tag == Tag::WebkitFillAvailable;
15156 }
15157#endif
15158
15159 static StyleGenericSize Stretch() {
15160 StyleGenericSize result;
15161 result.tag = Tag::Stretch;
15162 return result;
15163 }
15164
15165 bool IsStretch() const {
15166 return tag == Tag::Stretch;
15167 }
15168
15169 static StyleGenericSize FitContentFunction(const LengthPercent &_0) {
15170 StyleGenericSize result;
15171 ::new (&result.fit_content_function._0) (LengthPercent)(_0);
15172 result.tag = Tag::FitContentFunction;
15173 return result;
15174 }
15175
15176 bool IsFitContentFunction() const {
15177 return tag == Tag::FitContentFunction;
15178 }
15179
15180 const LengthPercent& AsFitContentFunction() const {
15181 MOZ_DIAGNOSTIC_ASSERT(IsFitContentFunction())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsFitContentFunction())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsFitContentFunction()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("IsFitContentFunction()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 15181); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsFitContentFunction()"
")"); do { *((volatile int*)__null) = 15181; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
15182 return fit_content_function._0;
15183 }
15184
15185 static StyleGenericSize AnchorSizeFunction(const StyleBox<StyleGenericAnchorSizeFunction<LengthPercent>> &_0) {
15186 StyleGenericSize result;
15187 ::new (&result.anchor_size_function._0) (StyleBox<StyleGenericAnchorSizeFunction<LengthPercent>>)(_0);
15188 result.tag = Tag::AnchorSizeFunction;
15189 return result;
15190 }
15191
15192 bool IsAnchorSizeFunction() const {
15193 return tag == Tag::AnchorSizeFunction;
15194 }
15195
15196 const StyleBox<StyleGenericAnchorSizeFunction<LengthPercent>>& AsAnchorSizeFunction() const {
15197 MOZ_DIAGNOSTIC_ASSERT(IsAnchorSizeFunction())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAnchorSizeFunction())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAnchorSizeFunction()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("IsAnchorSizeFunction()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 15197); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAnchorSizeFunction()"
")"); do { *((volatile int*)__null) = 15197; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
15198 return anchor_size_function._0;
15199 }
15200
15201 bool operator==(const StyleGenericSize& other) const {
15202 if (tag != other.tag) {
15203 return false;
15204 }
15205 switch (tag) {
15206 case Tag::LengthPercentage: return length_percentage == other.length_percentage;
15207 case Tag::FitContentFunction: return fit_content_function == other.fit_content_function;
15208 case Tag::AnchorSizeFunction: return anchor_size_function == other.anchor_size_function;
15209 default: break;
15210 }
15211 return true;
15212 }
15213
15214 bool operator!=(const StyleGenericSize& other) const {
15215 return !(*this == other);
15216 }
15217
15218 private:
15219 StyleGenericSize() {
15220
15221 }
15222 public:
15223
15224
15225 ~StyleGenericSize() {
15226 switch (tag) {
15227 case Tag::LengthPercentage: length_percentage.~StyleLengthPercentage_Body(); break;
15228 case Tag::FitContentFunction: fit_content_function.~StyleFitContentFunction_Body(); break;
15229 case Tag::AnchorSizeFunction: anchor_size_function.~StyleAnchorSizeFunction_Body(); break;
15230 default: break;
15231 }
15232 }
15233
15234 StyleGenericSize(const StyleGenericSize& other)
15235 : tag(other.tag) {
15236 switch (tag) {
15237 case Tag::LengthPercentage: ::new (&length_percentage) (StyleLengthPercentage_Body)(other.length_percentage); break;
15238 case Tag::FitContentFunction: ::new (&fit_content_function) (StyleFitContentFunction_Body)(other.fit_content_function); break;
15239 case Tag::AnchorSizeFunction: ::new (&anchor_size_function) (StyleAnchorSizeFunction_Body)(other.anchor_size_function); break;
15240 default: break;
15241 }
15242 }
15243 StyleGenericSize& operator=(const StyleGenericSize& other) {
15244 if (this != &other) {
15245 this->~StyleGenericSize();
15246 new (this) StyleGenericSize(other);
15247 }
15248 return *this;
15249 }
15250 inline bool ConvertsToLength() const;
15251 inline nscoord ToLength() const;
15252 inline bool ConvertsToPercentage() const;
15253 inline float ToPercentage() const;
15254 inline bool HasPercent() const;
15255 inline bool HasLengthAndPercentage() const;
15256 inline bool BehavesLikeStretchOnInlineAxis() const;
15257 inline bool BehavesLikeStretchOnBlockAxis() const;
15258 inline bool BehavesLikeInitialValueOnBlockAxis() const;
15259 inline bool BehavesLikeInitialValue(LogicalAxis) const;
15260};
15261
15262/// A computed value for `min-width`, `min-height`, `width` or `height` property.
15263using StyleSize = StyleGenericSize<StyleNonNegativeLengthPercentage>;
15264
15265/// A generic value for the `max-width` or `max-height` property.
15266template<typename LengthPercent>
15267struct StyleGenericMaxSize {
15268 enum class Tag : uint8_t {
15269 LengthPercentage,
15270 None,
15271#if defined(CBINDGEN_IS_GECKO)
15272 MaxContent,
15273#endif
15274#if defined(CBINDGEN_IS_GECKO)
15275 MinContent,
15276#endif
15277#if defined(CBINDGEN_IS_GECKO)
15278 FitContent,
15279#endif
15280#if defined(CBINDGEN_IS_GECKO)
15281 MozAvailable,
15282#endif
15283#if defined(CBINDGEN_IS_GECKO)
15284 WebkitFillAvailable,
15285#endif
15286 Stretch,
15287 FitContentFunction,
15288 AnchorSizeFunction,
15289 };
15290
15291 struct StyleLengthPercentage_Body {
15292 LengthPercent _0;
15293
15294 bool operator==(const StyleLengthPercentage_Body& other) const {
15295 return _0 == other._0;
15296 }
15297 bool operator!=(const StyleLengthPercentage_Body& other) const {
15298 return _0 != other._0;
15299 }
15300 };
15301
15302 struct StyleFitContentFunction_Body {
15303 LengthPercent _0;
15304
15305 bool operator==(const StyleFitContentFunction_Body& other) const {
15306 return _0 == other._0;
15307 }
15308 bool operator!=(const StyleFitContentFunction_Body& other) const {
15309 return _0 != other._0;
15310 }
15311 };
15312
15313 struct StyleAnchorSizeFunction_Body {
15314 StyleBox<StyleGenericAnchorSizeFunction<LengthPercent>> _0;
15315
15316 bool operator==(const StyleAnchorSizeFunction_Body& other) const {
15317 return _0 == other._0;
15318 }
15319 bool operator!=(const StyleAnchorSizeFunction_Body& other) const {
15320 return _0 != other._0;
15321 }
15322 };
15323
15324 Tag tag;
15325 union {
15326 StyleLengthPercentage_Body length_percentage;
15327 StyleFitContentFunction_Body fit_content_function;
15328 StyleAnchorSizeFunction_Body anchor_size_function;
15329 };
15330
15331 static StyleGenericMaxSize LengthPercentage(const LengthPercent &_0) {
15332 StyleGenericMaxSize result;
15333 ::new (&result.length_percentage._0) (LengthPercent)(_0);
15334 result.tag = Tag::LengthPercentage;
15335 return result;
15336 }
15337
15338 bool IsLengthPercentage() const {
15339 return tag == Tag::LengthPercentage;
15340 }
15341
15342 const LengthPercent& AsLengthPercentage() const {
15343 MOZ_DIAGNOSTIC_ASSERT(IsLengthPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLengthPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLengthPercentage()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsLengthPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 15343); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLengthPercentage()"
")"); do { *((volatile int*)__null) = 15343; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
15344 return length_percentage._0;
15345 }
15346
15347 static StyleGenericMaxSize None() {
15348 StyleGenericMaxSize result;
15349 result.tag = Tag::None;
15350 return result;
15351 }
15352
15353 bool IsNone() const {
15354 return tag == Tag::None;
15355 }
15356
15357#if defined(CBINDGEN_IS_GECKO)
15358 static StyleGenericMaxSize MaxContent() {
15359 StyleGenericMaxSize result;
15360 result.tag = Tag::MaxContent;
15361 return result;
15362 }
15363
15364 bool IsMaxContent() const {
15365 return tag == Tag::MaxContent;
15366 }
15367#endif
15368
15369#if defined(CBINDGEN_IS_GECKO)
15370 static StyleGenericMaxSize MinContent() {
15371 StyleGenericMaxSize result;
15372 result.tag = Tag::MinContent;
15373 return result;
15374 }
15375
15376 bool IsMinContent() const {
15377 return tag == Tag::MinContent;
15378 }
15379#endif
15380
15381#if defined(CBINDGEN_IS_GECKO)
15382 static StyleGenericMaxSize FitContent() {
15383 StyleGenericMaxSize result;
15384 result.tag = Tag::FitContent;
15385 return result;
15386 }
15387
15388 bool IsFitContent() const {
15389 return tag == Tag::FitContent;
15390 }
15391#endif
15392
15393#if defined(CBINDGEN_IS_GECKO)
15394 static StyleGenericMaxSize MozAvailable() {
15395 StyleGenericMaxSize result;
15396 result.tag = Tag::MozAvailable;
15397 return result;
15398 }
15399
15400 bool IsMozAvailable() const {
15401 return tag == Tag::MozAvailable;
15402 }
15403#endif
15404
15405#if defined(CBINDGEN_IS_GECKO)
15406 static StyleGenericMaxSize WebkitFillAvailable() {
15407 StyleGenericMaxSize result;
15408 result.tag = Tag::WebkitFillAvailable;
15409 return result;
15410 }
15411
15412 bool IsWebkitFillAvailable() const {
15413 return tag == Tag::WebkitFillAvailable;
15414 }
15415#endif
15416
15417 static StyleGenericMaxSize Stretch() {
15418 StyleGenericMaxSize result;
15419 result.tag = Tag::Stretch;
15420 return result;
15421 }
15422
15423 bool IsStretch() const {
15424 return tag == Tag::Stretch;
15425 }
15426
15427 static StyleGenericMaxSize FitContentFunction(const LengthPercent &_0) {
15428 StyleGenericMaxSize result;
15429 ::new (&result.fit_content_function._0) (LengthPercent)(_0);
15430 result.tag = Tag::FitContentFunction;
15431 return result;
15432 }
15433
15434 bool IsFitContentFunction() const {
15435 return tag == Tag::FitContentFunction;
15436 }
15437
15438 const LengthPercent& AsFitContentFunction() const {
15439 MOZ_DIAGNOSTIC_ASSERT(IsFitContentFunction())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsFitContentFunction())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsFitContentFunction()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("IsFitContentFunction()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 15439); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsFitContentFunction()"
")"); do { *((volatile int*)__null) = 15439; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
15440 return fit_content_function._0;
15441 }
15442
15443 static StyleGenericMaxSize AnchorSizeFunction(const StyleBox<StyleGenericAnchorSizeFunction<LengthPercent>> &_0) {
15444 StyleGenericMaxSize result;
15445 ::new (&result.anchor_size_function._0) (StyleBox<StyleGenericAnchorSizeFunction<LengthPercent>>)(_0);
15446 result.tag = Tag::AnchorSizeFunction;
15447 return result;
15448 }
15449
15450 bool IsAnchorSizeFunction() const {
15451 return tag == Tag::AnchorSizeFunction;
15452 }
15453
15454 const StyleBox<StyleGenericAnchorSizeFunction<LengthPercent>>& AsAnchorSizeFunction() const {
15455 MOZ_DIAGNOSTIC_ASSERT(IsAnchorSizeFunction())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAnchorSizeFunction())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAnchorSizeFunction()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("IsAnchorSizeFunction()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 15455); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAnchorSizeFunction()"
")"); do { *((volatile int*)__null) = 15455; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
15456 return anchor_size_function._0;
15457 }
15458
15459 bool operator==(const StyleGenericMaxSize& other) const {
15460 if (tag != other.tag) {
15461 return false;
15462 }
15463 switch (tag) {
15464 case Tag::LengthPercentage: return length_percentage == other.length_percentage;
15465 case Tag::FitContentFunction: return fit_content_function == other.fit_content_function;
15466 case Tag::AnchorSizeFunction: return anchor_size_function == other.anchor_size_function;
15467 default: break;
15468 }
15469 return true;
15470 }
15471
15472 bool operator!=(const StyleGenericMaxSize& other) const {
15473 return !(*this == other);
15474 }
15475
15476 private:
15477 StyleGenericMaxSize() {
15478
15479 }
15480 public:
15481
15482
15483 ~StyleGenericMaxSize() {
15484 switch (tag) {
15485 case Tag::LengthPercentage: length_percentage.~StyleLengthPercentage_Body(); break;
15486 case Tag::FitContentFunction: fit_content_function.~StyleFitContentFunction_Body(); break;
15487 case Tag::AnchorSizeFunction: anchor_size_function.~StyleAnchorSizeFunction_Body(); break;
15488 default: break;
15489 }
15490 }
15491
15492 StyleGenericMaxSize(const StyleGenericMaxSize& other)
15493 : tag(other.tag) {
15494 switch (tag) {
15495 case Tag::LengthPercentage: ::new (&length_percentage) (StyleLengthPercentage_Body)(other.length_percentage); break;
15496 case Tag::FitContentFunction: ::new (&fit_content_function) (StyleFitContentFunction_Body)(other.fit_content_function); break;
15497 case Tag::AnchorSizeFunction: ::new (&anchor_size_function) (StyleAnchorSizeFunction_Body)(other.anchor_size_function); break;
15498 default: break;
15499 }
15500 }
15501 StyleGenericMaxSize& operator=(const StyleGenericMaxSize& other) {
15502 if (this != &other) {
15503 this->~StyleGenericMaxSize();
15504 new (this) StyleGenericMaxSize(other);
15505 }
15506 return *this;
15507 }
15508 inline bool ConvertsToLength() const;
15509 inline nscoord ToLength() const;
15510 inline bool ConvertsToPercentage() const;
15511 inline float ToPercentage() const;
15512 inline bool HasPercent() const;
15513 inline bool HasLengthAndPercentage() const;
15514 inline bool BehavesLikeStretchOnInlineAxis() const;
15515 inline bool BehavesLikeStretchOnBlockAxis() const;
15516 inline bool BehavesLikeInitialValueOnBlockAxis() const;
15517 inline bool BehavesLikeInitialValue(LogicalAxis) const;
15518};
15519
15520/// A computed value for `max-width` or `max-height` property.
15521using StyleMaxSize = StyleGenericMaxSize<StyleNonNegativeLengthPercentage>;
15522
15523/// A generic value for the `flex-basis` property.
15524template<typename S>
15525struct StyleGenericFlexBasis {
15526 enum class Tag {
15527 /// `content`
15528 Content,
15529 /// `<width>`
15530 Size,
15531 };
15532
15533 struct StyleSize_Body {
15534 S _0;
15535
15536 bool operator==(const StyleSize_Body& other) const {
15537 return _0 == other._0;
15538 }
15539 bool operator!=(const StyleSize_Body& other) const {
15540 return _0 != other._0;
15541 }
15542 };
15543
15544 Tag tag;
15545 union {
15546 StyleSize_Body size;
15547 };
15548
15549 static StyleGenericFlexBasis Content() {
15550 StyleGenericFlexBasis result;
15551 result.tag = Tag::Content;
15552 return result;
15553 }
15554
15555 bool IsContent() const {
15556 return tag == Tag::Content;
15557 }
15558
15559 static StyleGenericFlexBasis Size(const S &_0) {
15560 StyleGenericFlexBasis result;
15561 ::new (&result.size._0) (S)(_0);
15562 result.tag = Tag::Size;
15563 return result;
15564 }
15565
15566 bool IsSize() const {
15567 return tag == Tag::Size;
15568 }
15569
15570 const S& AsSize() const {
15571 MOZ_DIAGNOSTIC_ASSERT(IsSize())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSize())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSize()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSize()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 15571); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSize()"
")"); do { *((volatile int*)__null) = 15571; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
15572 return size._0;
15573 }
15574
15575 bool operator==(const StyleGenericFlexBasis& other) const {
15576 if (tag != other.tag) {
15577 return false;
15578 }
15579 switch (tag) {
15580 case Tag::Size: return size == other.size;
15581 default: break;
15582 }
15583 return true;
15584 }
15585
15586 bool operator!=(const StyleGenericFlexBasis& other) const {
15587 return !(*this == other);
15588 }
15589
15590 private:
15591 StyleGenericFlexBasis() {
15592
15593 }
15594 public:
15595
15596
15597 ~StyleGenericFlexBasis() {
15598 switch (tag) {
15599 case Tag::Size: size.~StyleSize_Body(); break;
15600 default: break;
15601 }
15602 }
15603
15604 StyleGenericFlexBasis(const StyleGenericFlexBasis& other)
15605 : tag(other.tag) {
15606 switch (tag) {
15607 case Tag::Size: ::new (&size) (StyleSize_Body)(other.size); break;
15608 default: break;
15609 }
15610 }
15611 StyleGenericFlexBasis& operator=(const StyleGenericFlexBasis& other) {
15612 if (this != &other) {
15613 this->~StyleGenericFlexBasis();
15614 new (this) StyleGenericFlexBasis(other);
15615 }
15616 return *this;
15617 }
15618 inline bool IsAuto() const;
15619};
15620
15621/// A computed value for the `flex-basis` property.
15622using StyleFlexBasis = StyleGenericFlexBasis<StyleSize>;
15623
15624/// A generic value for the `background-size` property.
15625template<typename LengthPercent>
15626struct StyleGenericBackgroundSize {
15627 enum class Tag : uint8_t {
15628 /// `<width> <height>`
15629 ExplicitSize,
15630 /// `cover`
15631 Cover,
15632 /// `contain`
15633 Contain,
15634 };
15635
15636 struct StyleExplicitSize_Body {
15637 /// Explicit width.
15638 StyleGenericLengthPercentageOrAuto<LengthPercent> width;
15639 /// Explicit height.
15640 StyleGenericLengthPercentageOrAuto<LengthPercent> height;
15641
15642 bool operator==(const StyleExplicitSize_Body& other) const {
15643 return width == other.width &&
15644 height == other.height;
15645 }
15646 bool operator!=(const StyleExplicitSize_Body& other) const {
15647 return width != other.width ||
15648 height != other.height;
15649 }
15650 };
15651
15652 Tag tag;
15653 union {
15654 StyleExplicitSize_Body explicit_size;
15655 };
15656
15657 static StyleGenericBackgroundSize ExplicitSize(const StyleGenericLengthPercentageOrAuto<LengthPercent> &width,
15658 const StyleGenericLengthPercentageOrAuto<LengthPercent> &height) {
15659 StyleGenericBackgroundSize result;
15660 ::new (&result.explicit_size.width) (StyleGenericLengthPercentageOrAuto<LengthPercent>)(width);
15661 ::new (&result.explicit_size.height) (StyleGenericLengthPercentageOrAuto<LengthPercent>)(height);
15662 result.tag = Tag::ExplicitSize;
15663 return result;
15664 }
15665
15666 bool IsExplicitSize() const {
15667 return tag == Tag::ExplicitSize;
15668 }
15669
15670 const StyleExplicitSize_Body& AsExplicitSize() const {
15671 MOZ_DIAGNOSTIC_ASSERT(IsExplicitSize())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsExplicitSize())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsExplicitSize()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsExplicitSize()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 15671); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsExplicitSize()"
")"); do { *((volatile int*)__null) = 15671; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
15672 return explicit_size;
15673 }
15674
15675 static StyleGenericBackgroundSize Cover() {
15676 StyleGenericBackgroundSize result;
15677 result.tag = Tag::Cover;
15678 return result;
15679 }
15680
15681 bool IsCover() const {
15682 return tag == Tag::Cover;
15683 }
15684
15685 static StyleGenericBackgroundSize Contain() {
15686 StyleGenericBackgroundSize result;
15687 result.tag = Tag::Contain;
15688 return result;
15689 }
15690
15691 bool IsContain() const {
15692 return tag == Tag::Contain;
15693 }
15694
15695 bool operator==(const StyleGenericBackgroundSize& other) const {
15696 if (tag != other.tag) {
15697 return false;
15698 }
15699 switch (tag) {
15700 case Tag::ExplicitSize: return explicit_size == other.explicit_size;
15701 default: break;
15702 }
15703 return true;
15704 }
15705
15706 bool operator!=(const StyleGenericBackgroundSize& other) const {
15707 return !(*this == other);
15708 }
15709
15710 private:
15711 StyleGenericBackgroundSize() {
15712
15713 }
15714 public:
15715
15716
15717 ~StyleGenericBackgroundSize() {
15718 switch (tag) {
15719 case Tag::ExplicitSize: explicit_size.~StyleExplicitSize_Body(); break;
15720 default: break;
15721 }
15722 }
15723
15724 StyleGenericBackgroundSize(const StyleGenericBackgroundSize& other)
15725 : tag(other.tag) {
15726 switch (tag) {
15727 case Tag::ExplicitSize: ::new (&explicit_size) (StyleExplicitSize_Body)(other.explicit_size); break;
15728 default: break;
15729 }
15730 }
15731 StyleGenericBackgroundSize& operator=(const StyleGenericBackgroundSize& other) {
15732 if (this != &other) {
15733 this->~StyleGenericBackgroundSize();
15734 new (this) StyleGenericBackgroundSize(other);
15735 }
15736 return *this;
15737 }
15738 bool IsInitialValue() const;
15739};
15740
15741/// A computed value for the `background-size` property.
15742using StyleBackgroundSize = StyleGenericBackgroundSize<StyleNonNegativeLengthPercentage>;
15743
15744struct StyleNumberOrPercentage {
15745 enum class Tag : uint8_t {
15746 Percentage,
15747 Number,
15748 };
15749
15750 struct StylePercentage_Body {
15751 StylePercentage _0;
15752
15753 bool operator==(const StylePercentage_Body& other) const {
15754 return _0 == other._0;
15755 }
15756 bool operator!=(const StylePercentage_Body& other) const {
15757 return _0 != other._0;
15758 }
15759 };
15760
15761 struct StyleNumber_Body {
15762 StyleNumber _0;
15763
15764 bool operator==(const StyleNumber_Body& other) const {
15765 return _0 == other._0;
15766 }
15767 bool operator!=(const StyleNumber_Body& other) const {
15768 return _0 != other._0;
15769 }
15770 };
15771
15772 Tag tag;
15773 union {
15774 StylePercentage_Body percentage;
15775 StyleNumber_Body number;
15776 };
15777
15778 static StyleNumberOrPercentage Percentage(const StylePercentage &_0) {
15779 StyleNumberOrPercentage result;
15780 ::new (&result.percentage._0) (StylePercentage)(_0);
15781 result.tag = Tag::Percentage;
15782 return result;
15783 }
15784
15785 bool IsPercentage() const {
15786 return tag == Tag::Percentage;
15787 }
15788
15789 const StylePercentage& AsPercentage() const {
15790 MOZ_DIAGNOSTIC_ASSERT(IsPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPercentage()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 15790); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPercentage()"
")"); do { *((volatile int*)__null) = 15790; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
15791 return percentage._0;
15792 }
15793
15794 static StyleNumberOrPercentage Number(const StyleNumber &_0) {
15795 StyleNumberOrPercentage result;
15796 ::new (&result.number._0) (StyleNumber)(_0);
15797 result.tag = Tag::Number;
15798 return result;
15799 }
15800
15801 bool IsNumber() const {
15802 return tag == Tag::Number;
15803 }
15804
15805 const StyleNumber& AsNumber() const {
15806 MOZ_DIAGNOSTIC_ASSERT(IsNumber())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsNumber())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsNumber()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsNumber()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 15806); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsNumber()"
")"); do { *((volatile int*)__null) = 15806; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
15807 return number._0;
15808 }
15809
15810 bool operator==(const StyleNumberOrPercentage& other) const {
15811 if (tag != other.tag) {
15812 return false;
15813 }
15814 switch (tag) {
15815 case Tag::Percentage: return percentage == other.percentage;
15816 case Tag::Number: return number == other.number;
15817
15818 }
15819 return true;
15820 }
15821
15822 bool operator!=(const StyleNumberOrPercentage& other) const {
15823 return !(*this == other);
15824 }
15825
15826 private:
15827 StyleNumberOrPercentage() {
15828
15829 }
15830 public:
15831
15832
15833 ~StyleNumberOrPercentage() {
15834 switch (tag) {
15835 case Tag::Percentage: percentage.~StylePercentage_Body(); break;
15836 case Tag::Number: number.~StyleNumber_Body(); break;
15837
15838 }
15839 }
15840
15841 StyleNumberOrPercentage(const StyleNumberOrPercentage& other)
15842 : tag(other.tag) {
15843 switch (tag) {
15844 case Tag::Percentage: ::new (&percentage) (StylePercentage_Body)(other.percentage); break;
15845 case Tag::Number: ::new (&number) (StyleNumber_Body)(other.number); break;
15846
15847 }
15848 }
15849 StyleNumberOrPercentage& operator=(const StyleNumberOrPercentage& other) {
15850 if (this != &other) {
15851 this->~StyleNumberOrPercentage();
15852 new (this) StyleNumberOrPercentage(other);
15853 }
15854 return *this;
15855 }
15856};
15857
15858/// A non-negative <number-percentage>.
15859using StyleNonNegativeNumberOrPercentage = StyleNonNegative<StyleNumberOrPercentage>;
15860
15861/// A generic value for the `border-image-slice` property.
15862template<typename NumberOrPercentage>
15863struct StyleGenericBorderImageSlice {
15864 /// The offsets.
15865 StyleRect<NumberOrPercentage> offsets;
15866 /// Whether to fill the middle part.
15867 bool fill;
15868
15869 bool operator==(const StyleGenericBorderImageSlice& other) const {
15870 return offsets == other.offsets &&
15871 fill == other.fill;
15872 }
15873 bool operator!=(const StyleGenericBorderImageSlice& other) const {
15874 return offsets != other.offsets ||
15875 fill != other.fill;
15876 }
15877};
15878
15879/// A computed value for the `border-image-slice` property.
15880using StyleBorderImageSlice = StyleGenericBorderImageSlice<StyleNonNegativeNumberOrPercentage>;
15881
15882/// The specified value for the `border-image-repeat` property.
15883///
15884/// https://drafts.csswg.org/css-backgrounds/#the-border-image-repeat
15885struct StyleBorderImageRepeat {
15886 StyleBorderImageRepeatKeyword _0;
15887 StyleBorderImageRepeatKeyword _1;
15888
15889 bool operator==(const StyleBorderImageRepeat& other) const {
15890 return _0 == other._0 &&
15891 _1 == other._1;
15892 }
15893 bool operator!=(const StyleBorderImageRepeat& other) const {
15894 return _0 != other._0 ||
15895 _1 != other._1;
15896 }
15897};
15898
15899/// A computed value for the `border-radius` property.
15900using StyleBorderRadius = StyleGenericBorderRadius<StyleNonNegativeLengthPercentage>;
15901
15902/// Various flags to represent the color-scheme property in an efficient
15903/// way.
15904struct StyleColorSchemeFlags {
15905 uint8_t _0;
15906
15907 constexpr explicit operator bool() const {
15908 return !!_0;
15909 }
15910 constexpr StyleColorSchemeFlags operator~() const {
15911 return StyleColorSchemeFlags { static_cast<decltype(_0)>(~_0) };
15912 }
15913 constexpr StyleColorSchemeFlags operator|(const StyleColorSchemeFlags& other) const {
15914 return StyleColorSchemeFlags { static_cast<decltype(_0)>(this->_0 | other._0) };
15915 }
15916 StyleColorSchemeFlags& operator|=(const StyleColorSchemeFlags& other) {
15917 *this = (*this | other);
15918 return *this;
15919 }
15920 constexpr StyleColorSchemeFlags operator&(const StyleColorSchemeFlags& other) const {
15921 return StyleColorSchemeFlags { static_cast<decltype(_0)>(this->_0 & other._0) };
15922 }
15923 StyleColorSchemeFlags& operator&=(const StyleColorSchemeFlags& other) {
15924 *this = (*this & other);
15925 return *this;
15926 }
15927 constexpr StyleColorSchemeFlags operator^(const StyleColorSchemeFlags& other) const {
15928 return StyleColorSchemeFlags { static_cast<decltype(_0)>(this->_0 ^ other._0) };
15929 }
15930 StyleColorSchemeFlags& operator^=(const StyleColorSchemeFlags& other) {
15931 *this = (*this ^ other);
15932 return *this;
15933 }
15934 bool operator==(const StyleColorSchemeFlags& other) const {
15935 return _0 == other._0;
15936 }
15937 bool operator!=(const StyleColorSchemeFlags& other) const {
15938 return _0 != other._0;
15939 }
15940 static const StyleColorSchemeFlags LIGHT;
15941 static const StyleColorSchemeFlags DARK;
15942 static const StyleColorSchemeFlags ONLY;
15943};
15944/// Whether the author specified `light`.
15945constexpr inline const StyleColorSchemeFlags StyleColorSchemeFlags::LIGHT = StyleColorSchemeFlags{ /* ._0 = */ (uint8_t)(1 << 0) };
15946/// Whether the author specified `dark`.
15947constexpr inline const StyleColorSchemeFlags StyleColorSchemeFlags::DARK = StyleColorSchemeFlags{ /* ._0 = */ (uint8_t)(1 << 1) };
15948/// Whether the author specified `only`.
15949constexpr inline const StyleColorSchemeFlags StyleColorSchemeFlags::ONLY = StyleColorSchemeFlags{ /* ._0 = */ (uint8_t)(1 << 2) };
15950
15951/// <https://drafts.csswg.org/css-color-adjust/#color-scheme-prop>
15952struct StyleColorScheme {
15953 StyleArcSlice<StyleCustomIdent> idents;
15954 /// The computed bits for the known color schemes (plus the only keyword).
15955 StyleColorSchemeFlags bits;
15956
15957 bool operator==(const StyleColorScheme& other) const {
15958 return idents == other.idents &&
15959 bits == other.bits;
15960 }
15961 bool operator!=(const StyleColorScheme& other) const {
15962 return idents != other.idents ||
15963 bits != other.bits;
15964 }
15965};
15966
15967/// A wrapper of greater-than-or-equal-to-one values.
15968template<typename T>
15969using StyleGreaterThanOrEqualToOne = T;
15970
15971/// A wrapper of Integer, but only accept a value >= 1.
15972using StylePositiveInteger = StyleGreaterThanOrEqualToOne<StyleCSSInteger>;
15973
15974/// A generic type for `column-count` values.
15975template<typename PositiveInteger>
15976union StyleGenericColumnCount {
15977 enum class Tag : uint8_t {
15978 /// A positive integer.
15979 Integer,
15980 /// The keyword `auto`.
15981 Auto,
15982 };
15983
15984 struct Integer_Body {
15985 Tag tag;
15986 PositiveInteger _0;
15987
15988 bool operator==(const Integer_Body& other) const {
15989 return _0 == other._0;
15990 }
15991 bool operator!=(const Integer_Body& other) const {
15992 return _0 != other._0;
15993 }
15994 };
15995
15996 struct {
15997 Tag tag;
15998 };
15999 Integer_Body integer;
16000
16001 static StyleGenericColumnCount Integer(const PositiveInteger &_0) {
16002 StyleGenericColumnCount result;
16003 ::new (&result.integer._0) (PositiveInteger)(_0);
16004 result.tag = Tag::Integer;
16005 return result;
16006 }
16007
16008 bool IsInteger() const {
16009 return tag == Tag::Integer;
16010 }
16011
16012 const PositiveInteger& AsInteger() const {
16013 MOZ_DIAGNOSTIC_ASSERT(IsInteger())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsInteger())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsInteger()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsInteger()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 16013); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsInteger()"
")"); do { *((volatile int*)__null) = 16013; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
16014 return integer._0;
16015 }
16016
16017 static StyleGenericColumnCount Auto() {
16018 StyleGenericColumnCount result;
16019 result.tag = Tag::Auto;
16020 return result;
16021 }
16022
16023 bool IsAuto() const {
16024 return tag == Tag::Auto;
16025 }
16026
16027 bool operator==(const StyleGenericColumnCount& other) const {
16028 if (tag != other.tag) {
16029 return false;
16030 }
16031 switch (tag) {
16032 case Tag::Integer: return integer == other.integer;
16033 default: break;
16034 }
16035 return true;
16036 }
16037
16038 bool operator!=(const StyleGenericColumnCount& other) const {
16039 return !(*this == other);
16040 }
16041
16042 private:
16043 StyleGenericColumnCount() {
16044
16045 }
16046 public:
16047
16048
16049 ~StyleGenericColumnCount() {
16050 switch (tag) {
16051 case Tag::Integer: integer.~Integer_Body(); break;
16052 default: break;
16053 }
16054 }
16055
16056 StyleGenericColumnCount(const StyleGenericColumnCount& other)
16057 : tag(other.tag) {
16058 switch (tag) {
16059 case Tag::Integer: ::new (&integer) (Integer_Body)(other.integer); break;
16060 default: break;
16061 }
16062 }
16063 StyleGenericColumnCount& operator=(const StyleGenericColumnCount& other) {
16064 if (this != &other) {
16065 this->~StyleGenericColumnCount();
16066 new (this) StyleGenericColumnCount(other);
16067 }
16068 return *this;
16069 }
16070};
16071
16072/// A computed type for `column-count` values.
16073using StyleColumnCount = StyleGenericColumnCount<StylePositiveInteger>;
16074
16075/// A generic `<length>` | `<number>` value for the `tab-size` property.
16076template<typename L, typename N>
16077struct StyleGenericLengthOrNumber {
16078 enum class Tag : uint8_t {
16079 /// A number.
16080 ///
16081 /// NOTE: Numbers need to be before lengths, in order to parse them
16082 /// first, since `0` should be a number, not the `0px` length.
16083 Number,
16084 /// A length.
16085 Length,
16086 };
16087
16088 struct StyleNumber_Body {
16089 N _0;
16090
16091 bool operator==(const StyleNumber_Body& other) const {
16092 return _0 == other._0;
16093 }
16094 bool operator!=(const StyleNumber_Body& other) const {
16095 return _0 != other._0;
16096 }
16097 };
16098
16099 struct StyleLength_Body {
16100 L _0;
16101
16102 bool operator==(const StyleLength_Body& other) const {
16103 return _0 == other._0;
16104 }
16105 bool operator!=(const StyleLength_Body& other) const {
16106 return _0 != other._0;
16107 }
16108 };
16109
16110 Tag tag;
16111 union {
16112 StyleNumber_Body number;
16113 StyleLength_Body length;
16114 };
16115
16116 static StyleGenericLengthOrNumber Number(const N &_0) {
16117 StyleGenericLengthOrNumber result;
16118 ::new (&result.number._0) (N)(_0);
16119 result.tag = Tag::Number;
16120 return result;
16121 }
16122
16123 bool IsNumber() const {
16124 return tag == Tag::Number;
16125 }
16126
16127 const N& AsNumber() const {
16128 MOZ_DIAGNOSTIC_ASSERT(IsNumber())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsNumber())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsNumber()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsNumber()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 16128); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsNumber()"
")"); do { *((volatile int*)__null) = 16128; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
16129 return number._0;
16130 }
16131
16132 static StyleGenericLengthOrNumber Length(const L &_0) {
16133 StyleGenericLengthOrNumber result;
16134 ::new (&result.length._0) (L)(_0);
16135 result.tag = Tag::Length;
16136 return result;
16137 }
16138
16139 bool IsLength() const {
16140 return tag == Tag::Length;
16141 }
16142
16143 const L& AsLength() const {
16144 MOZ_DIAGNOSTIC_ASSERT(IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLength()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 16144); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLength()"
")"); do { *((volatile int*)__null) = 16144; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
16145 return length._0;
16146 }
16147
16148 bool operator==(const StyleGenericLengthOrNumber& other) const {
16149 if (tag != other.tag) {
16150 return false;
16151 }
16152 switch (tag) {
16153 case Tag::Number: return number == other.number;
16154 case Tag::Length: return length == other.length;
16155
16156 }
16157 return true;
16158 }
16159
16160 bool operator!=(const StyleGenericLengthOrNumber& other) const {
16161 return !(*this == other);
16162 }
16163
16164 private:
16165 StyleGenericLengthOrNumber() {
16166
16167 }
16168 public:
16169
16170
16171 ~StyleGenericLengthOrNumber() {
16172 switch (tag) {
16173 case Tag::Number: number.~StyleNumber_Body(); break;
16174 case Tag::Length: length.~StyleLength_Body(); break;
16175
16176 }
16177 }
16178
16179 StyleGenericLengthOrNumber(const StyleGenericLengthOrNumber& other)
16180 : tag(other.tag) {
16181 switch (tag) {
16182 case Tag::Number: ::new (&number) (StyleNumber_Body)(other.number); break;
16183 case Tag::Length: ::new (&length) (StyleLength_Body)(other.length); break;
16184
16185 }
16186 }
16187 StyleGenericLengthOrNumber& operator=(const StyleGenericLengthOrNumber& other) {
16188 if (this != &other) {
16189 this->~StyleGenericLengthOrNumber();
16190 new (this) StyleGenericLengthOrNumber(other);
16191 }
16192 return *this;
16193 }
16194};
16195
16196/// Either a non-negative `<length>` or a `<number>`.
16197using StyleNonNegativeLengthOrNumber = StyleGenericLengthOrNumber<StyleNonNegativeLength, StyleNonNegativeNumber>;
16198
16199/// A specified rectangle made of four `<length-or-number>` values.
16200using StyleNonNegativeLengthOrNumberRect = StyleRect<StyleNonNegativeLengthOrNumber>;
16201
16202/// A generic value for the `perspective` property.
16203template<typename NonNegativeLength>
16204struct StyleGenericPerspective {
16205 enum class Tag : uint8_t {
16206 /// A non-negative length.
16207 Length,
16208 /// The keyword `none`.
16209 None,
16210 };
16211
16212 struct StyleLength_Body {
16213 NonNegativeLength _0;
16214
16215 bool operator==(const StyleLength_Body& other) const {
16216 return _0 == other._0;
16217 }
16218 bool operator!=(const StyleLength_Body& other) const {
16219 return _0 != other._0;
16220 }
16221 };
16222
16223 Tag tag;
16224 union {
16225 StyleLength_Body length;
16226 };
16227
16228 static StyleGenericPerspective Length(const NonNegativeLength &_0) {
16229 StyleGenericPerspective result;
16230 ::new (&result.length._0) (NonNegativeLength)(_0);
16231 result.tag = Tag::Length;
16232 return result;
16233 }
16234
16235 bool IsLength() const {
16236 return tag == Tag::Length;
16237 }
16238
16239 const NonNegativeLength& AsLength() const {
16240 MOZ_DIAGNOSTIC_ASSERT(IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLength()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 16240); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLength()"
")"); do { *((volatile int*)__null) = 16240; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
16241 return length._0;
16242 }
16243
16244 static StyleGenericPerspective None() {
16245 StyleGenericPerspective result;
16246 result.tag = Tag::None;
16247 return result;
16248 }
16249
16250 bool IsNone() const {
16251 return tag == Tag::None;
16252 }
16253
16254 bool operator==(const StyleGenericPerspective& other) const {
16255 if (tag != other.tag) {
16256 return false;
16257 }
16258 switch (tag) {
16259 case Tag::Length: return length == other.length;
16260 default: break;
16261 }
16262 return true;
16263 }
16264
16265 bool operator!=(const StyleGenericPerspective& other) const {
16266 return !(*this == other);
16267 }
16268
16269 private:
16270 StyleGenericPerspective() {
16271
16272 }
16273 public:
16274
16275
16276 ~StyleGenericPerspective() {
16277 switch (tag) {
16278 case Tag::Length: length.~StyleLength_Body(); break;
16279 default: break;
16280 }
16281 }
16282
16283 StyleGenericPerspective(const StyleGenericPerspective& other)
16284 : tag(other.tag) {
16285 switch (tag) {
16286 case Tag::Length: ::new (&length) (StyleLength_Body)(other.length); break;
16287 default: break;
16288 }
16289 }
16290 StyleGenericPerspective& operator=(const StyleGenericPerspective& other) {
16291 if (this != &other) {
16292 this->~StyleGenericPerspective();
16293 new (this) StyleGenericPerspective(other);
16294 }
16295 return *this;
16296 }
16297};
16298
16299/// A computed value for the `perspective` property.
16300using StylePerspective = StyleGenericPerspective<StyleNonNegativeLength>;
16301
16302/// A generic value for the `z-index` property.
16303template<typename I>
16304struct StyleGenericZIndex {
16305 enum class Tag : uint8_t {
16306 /// An integer value.
16307 Integer,
16308 /// The keyword `auto`.
16309 Auto,
16310 };
16311
16312 struct StyleInteger_Body {
16313 I _0;
16314
16315 bool operator==(const StyleInteger_Body& other) const {
16316 return _0 == other._0;
16317 }
16318 bool operator!=(const StyleInteger_Body& other) const {
16319 return _0 != other._0;
16320 }
16321 };
16322
16323 Tag tag;
16324 union {
16325 StyleInteger_Body integer;
16326 };
16327
16328 static StyleGenericZIndex Integer(const I &_0) {
16329 StyleGenericZIndex result;
16330 ::new (&result.integer._0) (I)(_0);
16331 result.tag = Tag::Integer;
16332 return result;
16333 }
16334
16335 bool IsInteger() const {
16336 return tag == Tag::Integer;
16337 }
16338
16339 const I& AsInteger() const {
16340 MOZ_DIAGNOSTIC_ASSERT(IsInteger())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsInteger())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsInteger()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsInteger()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 16340); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsInteger()"
")"); do { *((volatile int*)__null) = 16340; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
16341 return integer._0;
16342 }
16343
16344 static StyleGenericZIndex Auto() {
16345 StyleGenericZIndex result;
16346 result.tag = Tag::Auto;
16347 return result;
16348 }
16349
16350 bool IsAuto() const {
16351 return tag == Tag::Auto;
16352 }
16353
16354 bool operator==(const StyleGenericZIndex& other) const {
16355 if (tag != other.tag) {
16356 return false;
16357 }
16358 switch (tag) {
16359 case Tag::Integer: return integer == other.integer;
16360 default: break;
16361 }
16362 return true;
16363 }
16364
16365 bool operator!=(const StyleGenericZIndex& other) const {
16366 return !(*this == other);
16367 }
16368
16369 private:
16370 StyleGenericZIndex() {
16371
16372 }
16373 public:
16374
16375
16376 ~StyleGenericZIndex() {
16377 switch (tag) {
16378 case Tag::Integer: integer.~StyleInteger_Body(); break;
16379 default: break;
16380 }
16381 }
16382
16383 StyleGenericZIndex(const StyleGenericZIndex& other)
16384 : tag(other.tag) {
16385 switch (tag) {
16386 case Tag::Integer: ::new (&integer) (StyleInteger_Body)(other.integer); break;
16387 default: break;
16388 }
16389 }
16390 StyleGenericZIndex& operator=(const StyleGenericZIndex& other) {
16391 if (this != &other) {
16392 this->~StyleGenericZIndex();
16393 new (this) StyleGenericZIndex(other);
16394 }
16395 return *this;
16396 }
16397};
16398
16399/// A computed value for the `z-index` property.
16400using StyleZIndex = StyleGenericZIndex<StyleInteger>;
16401
16402/// A generic transform origin.
16403template<typename H, typename V, typename Depth>
16404struct StyleGenericTransformOrigin {
16405 /// The horizontal origin.
16406 H horizontal;
16407 /// The vertical origin.
16408 V vertical;
16409 /// The depth.
16410 Depth depth;
16411
16412 bool operator==(const StyleGenericTransformOrigin& other) const {
16413 return horizontal == other.horizontal &&
16414 vertical == other.vertical &&
16415 depth == other.depth;
16416 }
16417 bool operator!=(const StyleGenericTransformOrigin& other) const {
16418 return horizontal != other.horizontal ||
16419 vertical != other.vertical ||
16420 depth != other.depth;
16421 }
16422 inline bool HasPercent() const;
16423};
16424
16425/// The computed value of a CSS `<transform-origin>`
16426using StyleTransformOrigin = StyleGenericTransformOrigin<StyleLengthPercentage, StyleLengthPercentage, StyleLength>;
16427
16428/// Note that we only implement -webkit-line-clamp as a single, longhand
16429/// property for now, but the spec defines line-clamp as a shorthand for
16430/// separate max-lines, block-ellipsis, and continue properties.
16431///
16432/// https://drafts.csswg.org/css-overflow-3/#line-clamp
16433template<typename I>
16434using StyleGenericLineClamp = I;
16435
16436/// A computed value for the `line-clamp` property.
16437using StyleLineClamp = StyleGenericLineClamp<StyleInteger>;
16438
16439/// Constants for contain: https://drafts.csswg.org/css-contain/#contain-property
16440struct StyleContain {
16441 uint8_t _0;
16442
16443 constexpr explicit operator bool() const {
16444 return !!_0;
16445 }
16446 constexpr StyleContain operator~() const {
16447 return StyleContain { static_cast<decltype(_0)>(~_0) };
16448 }
16449 constexpr StyleContain operator|(const StyleContain& other) const {
16450 return StyleContain { static_cast<decltype(_0)>(this->_0 | other._0) };
16451 }
16452 StyleContain& operator|=(const StyleContain& other) {
16453 *this = (*this | other);
16454 return *this;
16455 }
16456 constexpr StyleContain operator&(const StyleContain& other) const {
16457 return StyleContain { static_cast<decltype(_0)>(this->_0 & other._0) };
16458 }
16459 StyleContain& operator&=(const StyleContain& other) {
16460 *this = (*this & other);
16461 return *this;
16462 }
16463 constexpr StyleContain operator^(const StyleContain& other) const {
16464 return StyleContain { static_cast<decltype(_0)>(this->_0 ^ other._0) };
16465 }
16466 StyleContain& operator^=(const StyleContain& other) {
16467 *this = (*this ^ other);
16468 return *this;
16469 }
16470 bool operator==(const StyleContain& other) const {
16471 return _0 == other._0;
16472 }
16473 bool operator!=(const StyleContain& other) const {
16474 return _0 != other._0;
16475 }
16476 static const StyleContain NONE;
16477 static const StyleContain INLINE_SIZE;
16478 static const StyleContain BLOCK_SIZE;
16479 static const StyleContain LAYOUT;
16480 static const StyleContain STYLE;
16481 static const StyleContain PAINT;
16482 static const StyleContain SIZE;
16483 static const StyleContain CONTENT;
16484 static const StyleContain STRICT;
16485};
16486/// `none` variant, just for convenience.
16487constexpr inline const StyleContain StyleContain::NONE = StyleContain{ /* ._0 = */ (uint8_t)0 };
16488/// `inline-size` variant, turns on single-axis inline size containment
16489constexpr inline const StyleContain StyleContain::INLINE_SIZE = StyleContain{ /* ._0 = */ (uint8_t)(1 << 0) };
16490/// `block-size` variant, turns on single-axis block size containment, internal only
16491constexpr inline const StyleContain StyleContain::BLOCK_SIZE = StyleContain{ /* ._0 = */ (uint8_t)(1 << 1) };
16492/// `layout` variant, turns on layout containment
16493constexpr inline const StyleContain StyleContain::LAYOUT = StyleContain{ /* ._0 = */ (uint8_t)(1 << 2) };
16494/// `style` variant, turns on style containment
16495constexpr inline const StyleContain StyleContain::STYLE = StyleContain{ /* ._0 = */ (uint8_t)(1 << 3) };
16496/// `paint` variant, turns on paint containment
16497constexpr inline const StyleContain StyleContain::PAINT = StyleContain{ /* ._0 = */ (uint8_t)(1 << 4) };
16498/// 'size' variant, turns on size containment
16499constexpr inline const StyleContain StyleContain::SIZE = StyleContain{ /* ._0 = */ (uint8_t)(((1 << 5) | (StyleContain::INLINE_SIZE)._0) | (StyleContain::BLOCK_SIZE)._0) };
16500/// `content` variant, turns on layout and paint containment
16501constexpr inline const StyleContain StyleContain::CONTENT = StyleContain{ /* ._0 = */ (uint8_t)((((1 << 6) | (StyleContain::LAYOUT)._0) | (StyleContain::STYLE)._0) | (StyleContain::PAINT)._0) };
16502/// `strict` variant, turns on all types of containment
16503constexpr inline const StyleContain StyleContain::STRICT = StyleContain{ /* ._0 = */ (uint8_t)(((((1 << 7) | (StyleContain::LAYOUT)._0) | (StyleContain::STYLE)._0) | (StyleContain::PAINT)._0) | (StyleContain::SIZE)._0) };
16504
16505/// https://drafts.csswg.org/css-contain-3/#container-name
16506using StyleContainerName = StyleOwnedSlice<StyleCustomIdent>;
16507
16508/// https://drafts.csswg.org/css-sizing-4/#intrinsic-size-override
16509template<typename L>
16510struct StyleGenericContainIntrinsicSize {
16511 enum class Tag : uint8_t {
16512 /// The keyword `none`.
16513 None,
16514 /// The keywords 'auto none',
16515 AutoNone,
16516 /// A non-negative length.
16517 Length,
16518 /// "auto <Length>"
16519 AutoLength,
16520 };
16521
16522 struct StyleLength_Body {
16523 L _0;
16524
16525 bool operator==(const StyleLength_Body& other) const {
16526 return _0 == other._0;
16527 }
16528 bool operator!=(const StyleLength_Body& other) const {
16529 return _0 != other._0;
16530 }
16531 };
16532
16533 struct StyleAutoLength_Body {
16534 L _0;
16535
16536 bool operator==(const StyleAutoLength_Body& other) const {
16537 return _0 == other._0;
16538 }
16539 bool operator!=(const StyleAutoLength_Body& other) const {
16540 return _0 != other._0;
16541 }
16542 };
16543
16544 Tag tag;
16545 union {
16546 StyleLength_Body length;
16547 StyleAutoLength_Body auto_length;
16548 };
16549
16550 static StyleGenericContainIntrinsicSize None() {
16551 StyleGenericContainIntrinsicSize result;
16552 result.tag = Tag::None;
16553 return result;
16554 }
16555
16556 bool IsNone() const {
16557 return tag == Tag::None;
16558 }
16559
16560 static StyleGenericContainIntrinsicSize AutoNone() {
16561 StyleGenericContainIntrinsicSize result;
16562 result.tag = Tag::AutoNone;
16563 return result;
16564 }
16565
16566 bool IsAutoNone() const {
16567 return tag == Tag::AutoNone;
16568 }
16569
16570 static StyleGenericContainIntrinsicSize Length(const L &_0) {
16571 StyleGenericContainIntrinsicSize result;
16572 ::new (&result.length._0) (L)(_0);
16573 result.tag = Tag::Length;
16574 return result;
16575 }
16576
16577 bool IsLength() const {
16578 return tag == Tag::Length;
16579 }
16580
16581 const L& AsLength() const {
16582 MOZ_DIAGNOSTIC_ASSERT(IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLength()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 16582); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLength()"
")"); do { *((volatile int*)__null) = 16582; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
16583 return length._0;
16584 }
16585
16586 static StyleGenericContainIntrinsicSize AutoLength(const L &_0) {
16587 StyleGenericContainIntrinsicSize result;
16588 ::new (&result.auto_length._0) (L)(_0);
16589 result.tag = Tag::AutoLength;
16590 return result;
16591 }
16592
16593 bool IsAutoLength() const {
16594 return tag == Tag::AutoLength;
16595 }
16596
16597 const L& AsAutoLength() const {
16598 MOZ_DIAGNOSTIC_ASSERT(IsAutoLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAutoLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAutoLength()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsAutoLength()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 16598); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAutoLength()"
")"); do { *((volatile int*)__null) = 16598; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
16599 return auto_length._0;
16600 }
16601
16602 bool operator==(const StyleGenericContainIntrinsicSize& other) const {
16603 if (tag != other.tag) {
16604 return false;
16605 }
16606 switch (tag) {
16607 case Tag::Length: return length == other.length;
16608 case Tag::AutoLength: return auto_length == other.auto_length;
16609 default: break;
16610 }
16611 return true;
16612 }
16613
16614 bool operator!=(const StyleGenericContainIntrinsicSize& other) const {
16615 return !(*this == other);
16616 }
16617
16618 private:
16619 StyleGenericContainIntrinsicSize() {
16620
16621 }
16622 public:
16623
16624
16625 ~StyleGenericContainIntrinsicSize() {
16626 switch (tag) {
16627 case Tag::Length: length.~StyleLength_Body(); break;
16628 case Tag::AutoLength: auto_length.~StyleAutoLength_Body(); break;
16629 default: break;
16630 }
16631 }
16632
16633 StyleGenericContainIntrinsicSize(const StyleGenericContainIntrinsicSize& other)
16634 : tag(other.tag) {
16635 switch (tag) {
16636 case Tag::Length: ::new (&length) (StyleLength_Body)(other.length); break;
16637 case Tag::AutoLength: ::new (&auto_length) (StyleAutoLength_Body)(other.auto_length); break;
16638 default: break;
16639 }
16640 }
16641 StyleGenericContainIntrinsicSize& operator=(const StyleGenericContainIntrinsicSize& other) {
16642 if (this != &other) {
16643 this->~StyleGenericContainIntrinsicSize();
16644 new (this) StyleGenericContainIntrinsicSize(other);
16645 }
16646 return *this;
16647 }
16648 bool HasAuto() const { return IsAutoLength() || IsAutoNone(); }
16649};
16650
16651/// A computed value for the `contain-intrinsic-size` property.
16652using StyleContainIntrinsicSize = StyleGenericContainIntrinsicSize<StyleNonNegativeLength>;
16653
16654/// Values for the `touch-action` property.
16655struct StyleTouchAction {
16656 uint8_t _0;
16657
16658 constexpr explicit operator bool() const {
16659 return !!_0;
16660 }
16661 constexpr StyleTouchAction operator~() const {
16662 return StyleTouchAction { static_cast<decltype(_0)>(~_0) };
16663 }
16664 constexpr StyleTouchAction operator|(const StyleTouchAction& other) const {
16665 return StyleTouchAction { static_cast<decltype(_0)>(this->_0 | other._0) };
16666 }
16667 StyleTouchAction& operator|=(const StyleTouchAction& other) {
16668 *this = (*this | other);
16669 return *this;
16670 }
16671 constexpr StyleTouchAction operator&(const StyleTouchAction& other) const {
16672 return StyleTouchAction { static_cast<decltype(_0)>(this->_0 & other._0) };
16673 }
16674 StyleTouchAction& operator&=(const StyleTouchAction& other) {
16675 *this = (*this & other);
16676 return *this;
16677 }
16678 constexpr StyleTouchAction operator^(const StyleTouchAction& other) const {
16679 return StyleTouchAction { static_cast<decltype(_0)>(this->_0 ^ other._0) };
16680 }
16681 StyleTouchAction& operator^=(const StyleTouchAction& other) {
16682 *this = (*this ^ other);
16683 return *this;
16684 }
16685 bool operator==(const StyleTouchAction& other) const {
16686 return _0 == other._0;
16687 }
16688 bool operator!=(const StyleTouchAction& other) const {
16689 return _0 != other._0;
16690 }
16691 static const StyleTouchAction NONE;
16692 static const StyleTouchAction AUTO;
16693 static const StyleTouchAction PAN_X;
16694 static const StyleTouchAction PAN_Y;
16695 static const StyleTouchAction MANIPULATION;
16696 static const StyleTouchAction PINCH_ZOOM;
16697};
16698/// `none` variant
16699constexpr inline const StyleTouchAction StyleTouchAction::NONE = StyleTouchAction{ /* ._0 = */ (uint8_t)(1 << 0) };
16700/// `auto` variant
16701constexpr inline const StyleTouchAction StyleTouchAction::AUTO = StyleTouchAction{ /* ._0 = */ (uint8_t)(1 << 1) };
16702/// `pan-x` variant
16703constexpr inline const StyleTouchAction StyleTouchAction::PAN_X = StyleTouchAction{ /* ._0 = */ (uint8_t)(1 << 2) };
16704/// `pan-y` variant
16705constexpr inline const StyleTouchAction StyleTouchAction::PAN_Y = StyleTouchAction{ /* ._0 = */ (uint8_t)(1 << 3) };
16706/// `manipulation` variant
16707constexpr inline const StyleTouchAction StyleTouchAction::MANIPULATION = StyleTouchAction{ /* ._0 = */ (uint8_t)(1 << 4) };
16708/// `pinch-zoom` variant
16709constexpr inline const StyleTouchAction StyleTouchAction::PINCH_ZOOM = StyleTouchAction{ /* ._0 = */ (uint8_t)(1 << 5) };
16710
16711/// The change bits that we care about.
16712struct StyleWillChangeBits {
16713 uint16_t _0;
16714
16715 constexpr explicit operator bool() const {
16716 return !!_0;
16717 }
16718 constexpr StyleWillChangeBits operator~() const {
16719 return StyleWillChangeBits { static_cast<decltype(_0)>(~_0) };
16720 }
16721 constexpr StyleWillChangeBits operator|(const StyleWillChangeBits& other) const {
16722 return StyleWillChangeBits { static_cast<decltype(_0)>(this->_0 | other._0) };
16723 }
16724 StyleWillChangeBits& operator|=(const StyleWillChangeBits& other) {
16725 *this = (*this | other);
16726 return *this;
16727 }
16728 constexpr StyleWillChangeBits operator&(const StyleWillChangeBits& other) const {
16729 return StyleWillChangeBits { static_cast<decltype(_0)>(this->_0 & other._0) };
16730 }
16731 StyleWillChangeBits& operator&=(const StyleWillChangeBits& other) {
16732 *this = (*this & other);
16733 return *this;
16734 }
16735 constexpr StyleWillChangeBits operator^(const StyleWillChangeBits& other) const {
16736 return StyleWillChangeBits { static_cast<decltype(_0)>(this->_0 ^ other._0) };
16737 }
16738 StyleWillChangeBits& operator^=(const StyleWillChangeBits& other) {
16739 *this = (*this ^ other);
16740 return *this;
16741 }
16742 bool operator==(const StyleWillChangeBits& other) const {
16743 return _0 == other._0;
16744 }
16745 bool operator!=(const StyleWillChangeBits& other) const {
16746 return _0 != other._0;
16747 }
16748 static const StyleWillChangeBits STACKING_CONTEXT_UNCONDITIONAL;
16749 static const StyleWillChangeBits TRANSFORM;
16750 static const StyleWillChangeBits SCROLL;
16751 static const StyleWillChangeBits CONTAIN;
16752 static const StyleWillChangeBits OPACITY;
16753 static const StyleWillChangeBits PERSPECTIVE;
16754 static const StyleWillChangeBits Z_INDEX;
16755 static const StyleWillChangeBits FIXPOS_CB_NON_SVG;
16756 static const StyleWillChangeBits POSITION;
16757};
16758/// Whether a property which can create a stacking context **on any
16759/// box** will change.
16760constexpr inline const StyleWillChangeBits StyleWillChangeBits::STACKING_CONTEXT_UNCONDITIONAL = StyleWillChangeBits{ /* ._0 = */ (uint16_t)(1 << 0) };
16761/// Whether `transform` or related properties will change.
16762constexpr inline const StyleWillChangeBits StyleWillChangeBits::TRANSFORM = StyleWillChangeBits{ /* ._0 = */ (uint16_t)(1 << 1) };
16763/// Whether `scroll-position` will change.
16764constexpr inline const StyleWillChangeBits StyleWillChangeBits::SCROLL = StyleWillChangeBits{ /* ._0 = */ (uint16_t)(1 << 2) };
16765/// Whether `contain` will change.
16766constexpr inline const StyleWillChangeBits StyleWillChangeBits::CONTAIN = StyleWillChangeBits{ /* ._0 = */ (uint16_t)(1 << 3) };
16767/// Whether `opacity` will change.
16768constexpr inline const StyleWillChangeBits StyleWillChangeBits::OPACITY = StyleWillChangeBits{ /* ._0 = */ (uint16_t)(1 << 4) };
16769/// Whether `perspective` will change.
16770constexpr inline const StyleWillChangeBits StyleWillChangeBits::PERSPECTIVE = StyleWillChangeBits{ /* ._0 = */ (uint16_t)(1 << 5) };
16771/// Whether `z-index` will change.
16772constexpr inline const StyleWillChangeBits StyleWillChangeBits::Z_INDEX = StyleWillChangeBits{ /* ._0 = */ (uint16_t)(1 << 6) };
16773/// Whether any property which creates a containing block for non-svg
16774/// text frames will change.
16775constexpr inline const StyleWillChangeBits StyleWillChangeBits::FIXPOS_CB_NON_SVG = StyleWillChangeBits{ /* ._0 = */ (uint16_t)(1 << 7) };
16776/// Whether the position property will change.
16777constexpr inline const StyleWillChangeBits StyleWillChangeBits::POSITION = StyleWillChangeBits{ /* ._0 = */ (uint16_t)(1 << 8) };
16778
16779/// Provides a rendering hint to the user agent, stating what kinds of changes
16780/// the author expects to perform on the element.
16781///
16782/// `auto` is represented by an empty `features` list.
16783///
16784/// <https://drafts.csswg.org/css-will-change/#will-change>
16785struct StyleWillChange {
16786 /// The features that are supposed to change.
16787 ///
16788 /// TODO(emilio): Consider using ArcSlice since we just clone them from the
16789 /// specified value? That'd save an allocation, which could be worth it.
16790 StyleOwnedSlice<StyleCustomIdent> features;
16791 /// A bitfield with the kind of change that the value will create, based
16792 /// on the above field.
16793 StyleWillChangeBits bits;
16794
16795 bool operator==(const StyleWillChange& other) const {
16796 return features == other.features &&
16797 bits == other.bits;
16798 }
16799 bool operator!=(const StyleWillChange& other) const {
16800 return features != other.features ||
16801 bits != other.bits;
16802 }
16803};
16804
16805/// Specified keyword values for the text-decoration-line property.
16806struct StyleTextDecorationLine {
16807 uint8_t _0;
16808
16809 constexpr explicit operator bool() const {
16810 return !!_0;
16811 }
16812 constexpr StyleTextDecorationLine operator~() const {
16813 return StyleTextDecorationLine { static_cast<decltype(_0)>(~_0) };
16814 }
16815 constexpr StyleTextDecorationLine operator|(const StyleTextDecorationLine& other) const {
16816 return StyleTextDecorationLine { static_cast<decltype(_0)>(this->_0 | other._0) };
16817 }
16818 StyleTextDecorationLine& operator|=(const StyleTextDecorationLine& other) {
16819 *this = (*this | other);
16820 return *this;
16821 }
16822 constexpr StyleTextDecorationLine operator&(const StyleTextDecorationLine& other) const {
16823 return StyleTextDecorationLine { static_cast<decltype(_0)>(this->_0 & other._0) };
16824 }
16825 StyleTextDecorationLine& operator&=(const StyleTextDecorationLine& other) {
16826 *this = (*this & other);
16827 return *this;
16828 }
16829 constexpr StyleTextDecorationLine operator^(const StyleTextDecorationLine& other) const {
16830 return StyleTextDecorationLine { static_cast<decltype(_0)>(this->_0 ^ other._0) };
16831 }
16832 StyleTextDecorationLine& operator^=(const StyleTextDecorationLine& other) {
16833 *this = (*this ^ other);
16834 return *this;
16835 }
16836 bool operator==(const StyleTextDecorationLine& other) const {
16837 return _0 == other._0;
16838 }
16839 bool operator!=(const StyleTextDecorationLine& other) const {
16840 return _0 != other._0;
16841 }
16842 static const StyleTextDecorationLine NONE;
16843 static const StyleTextDecorationLine UNDERLINE;
16844 static const StyleTextDecorationLine OVERLINE;
16845 static const StyleTextDecorationLine LINE_THROUGH;
16846 static const StyleTextDecorationLine BLINK;
16847 static const StyleTextDecorationLine COLOR_OVERRIDE;
16848};
16849/// No text decoration line is specified.
16850constexpr inline const StyleTextDecorationLine StyleTextDecorationLine::NONE = StyleTextDecorationLine{ /* ._0 = */ (uint8_t)0 };
16851/// underline
16852constexpr inline const StyleTextDecorationLine StyleTextDecorationLine::UNDERLINE = StyleTextDecorationLine{ /* ._0 = */ (uint8_t)(1 << 0) };
16853/// overline
16854constexpr inline const StyleTextDecorationLine StyleTextDecorationLine::OVERLINE = StyleTextDecorationLine{ /* ._0 = */ (uint8_t)(1 << 1) };
16855/// line-through
16856constexpr inline const StyleTextDecorationLine StyleTextDecorationLine::LINE_THROUGH = StyleTextDecorationLine{ /* ._0 = */ (uint8_t)(1 << 2) };
16857/// blink
16858constexpr inline const StyleTextDecorationLine StyleTextDecorationLine::BLINK = StyleTextDecorationLine{ /* ._0 = */ (uint8_t)(1 << 3) };
16859#if defined(CBINDGEN_IS_GECKO)
16860/// Only set by presentation attributes
16861///
16862/// Setting this will mean that text-decorations use the color
16863/// specified by `color` in quirks mode.
16864///
16865/// For example, this gives <a href=foo><font color="red">text</font></a>
16866/// a red text decoration
16867constexpr inline const StyleTextDecorationLine StyleTextDecorationLine::COLOR_OVERRIDE = StyleTextDecorationLine{ /* ._0 = */ (uint8_t)16 };
16868#endif
16869
16870/// Controls how the Masonry layout algorithm works
16871/// specifying exactly how auto-placed items get flowed in the masonry axis.
16872struct StyleMasonryAutoFlow {
16873 /// Specify how to pick a auto-placement track.
16874 StyleMasonryPlacement placement;
16875 /// Specify how to pick an item to place.
16876 StyleMasonryItemOrder order;
16877
16878 bool operator==(const StyleMasonryAutoFlow& other) const {
16879 return placement == other.placement &&
16880 order == other.order;
16881 }
16882 bool operator!=(const StyleMasonryAutoFlow& other) const {
16883 return placement != other.placement ||
16884 order != other.order;
16885 }
16886};
16887
16888/// Specified keyword values for the text-underline-position property.
16889/// (Non-exclusive, but not all combinations are allowed: the spec grammar gives
16890/// `auto | [ from-font | under ] || [ left | right ]`.)
16891/// https://drafts.csswg.org/css-text-decor-4/#text-underline-position-property
16892struct StyleTextUnderlinePosition {
16893 uint8_t _0;
16894
16895 constexpr explicit operator bool() const {
16896 return !!_0;
16897 }
16898 constexpr StyleTextUnderlinePosition operator~() const {
16899 return StyleTextUnderlinePosition { static_cast<decltype(_0)>(~_0) };
16900 }
16901 constexpr StyleTextUnderlinePosition operator|(const StyleTextUnderlinePosition& other) const {
16902 return StyleTextUnderlinePosition { static_cast<decltype(_0)>(this->_0 | other._0) };
16903 }
16904 StyleTextUnderlinePosition& operator|=(const StyleTextUnderlinePosition& other) {
16905 *this = (*this | other);
16906 return *this;
16907 }
16908 constexpr StyleTextUnderlinePosition operator&(const StyleTextUnderlinePosition& other) const {
16909 return StyleTextUnderlinePosition { static_cast<decltype(_0)>(this->_0 & other._0) };
16910 }
16911 StyleTextUnderlinePosition& operator&=(const StyleTextUnderlinePosition& other) {
16912 *this = (*this & other);
16913 return *this;
16914 }
16915 constexpr StyleTextUnderlinePosition operator^(const StyleTextUnderlinePosition& other) const {
16916 return StyleTextUnderlinePosition { static_cast<decltype(_0)>(this->_0 ^ other._0) };
16917 }
16918 StyleTextUnderlinePosition& operator^=(const StyleTextUnderlinePosition& other) {
16919 *this = (*this ^ other);
16920 return *this;
16921 }
16922 bool operator==(const StyleTextUnderlinePosition& other) const {
16923 return _0 == other._0;
16924 }
16925 bool operator!=(const StyleTextUnderlinePosition& other) const {
16926 return _0 != other._0;
16927 }
16928 inline bool IsAuto() const;
16929 inline bool IsFromFont() const;
16930 inline bool IsUnder() const;
16931 inline bool IsLeft() const;
16932 inline bool IsRight() const;
16933 static const StyleTextUnderlinePosition AUTO;
16934 static const StyleTextUnderlinePosition FROM_FONT;
16935 static const StyleTextUnderlinePosition UNDER;
16936 static const StyleTextUnderlinePosition LEFT;
16937 static const StyleTextUnderlinePosition RIGHT;
16938};
16939/// Use automatic positioning below the alphabetic baseline.
16940constexpr inline const StyleTextUnderlinePosition StyleTextUnderlinePosition::AUTO = StyleTextUnderlinePosition{ /* ._0 = */ (uint8_t)0 };
16941/// Use underline position from the first available font.
16942constexpr inline const StyleTextUnderlinePosition StyleTextUnderlinePosition::FROM_FONT = StyleTextUnderlinePosition{ /* ._0 = */ (uint8_t)(1 << 0) };
16943/// Below the glyph box.
16944constexpr inline const StyleTextUnderlinePosition StyleTextUnderlinePosition::UNDER = StyleTextUnderlinePosition{ /* ._0 = */ (uint8_t)(1 << 1) };
16945/// In vertical mode, place to the left of the text.
16946constexpr inline const StyleTextUnderlinePosition StyleTextUnderlinePosition::LEFT = StyleTextUnderlinePosition{ /* ._0 = */ (uint8_t)(1 << 2) };
16947/// In vertical mode, place to the right of the text.
16948constexpr inline const StyleTextUnderlinePosition StyleTextUnderlinePosition::RIGHT = StyleTextUnderlinePosition{ /* ._0 = */ (uint8_t)(1 << 3) };
16949
16950/// Specified value for the text-transform property.
16951/// (The spec grammar gives
16952/// `none | math-auto | [capitalize | uppercase | lowercase] || full-width || full-size-kana`.)
16953/// https://drafts.csswg.org/css-text-4/#text-transform-property
16954struct StyleTextTransform {
16955 uint8_t _0;
16956
16957 constexpr explicit operator bool() const {
16958 return !!_0;
16959 }
16960 constexpr StyleTextTransform operator~() const {
16961 return StyleTextTransform { static_cast<decltype(_0)>(~_0) };
16962 }
16963 constexpr StyleTextTransform operator|(const StyleTextTransform& other) const {
16964 return StyleTextTransform { static_cast<decltype(_0)>(this->_0 | other._0) };
16965 }
16966 StyleTextTransform& operator|=(const StyleTextTransform& other) {
16967 *this = (*this | other);
16968 return *this;
16969 }
16970 constexpr StyleTextTransform operator&(const StyleTextTransform& other) const {
16971 return StyleTextTransform { static_cast<decltype(_0)>(this->_0 & other._0) };
16972 }
16973 StyleTextTransform& operator&=(const StyleTextTransform& other) {
16974 *this = (*this & other);
16975 return *this;
16976 }
16977 constexpr StyleTextTransform operator^(const StyleTextTransform& other) const {
16978 return StyleTextTransform { static_cast<decltype(_0)>(this->_0 ^ other._0) };
16979 }
16980 StyleTextTransform& operator^=(const StyleTextTransform& other) {
16981 *this = (*this ^ other);
16982 return *this;
16983 }
16984 bool operator==(const StyleTextTransform& other) const {
16985 return _0 == other._0;
16986 }
16987 bool operator!=(const StyleTextTransform& other) const {
16988 return _0 != other._0;
16989 }
16990 bool IsNone() const { return *this == NONE; }
16991 static const StyleTextTransform NONE;
16992 static const StyleTextTransform UPPERCASE;
16993 static const StyleTextTransform LOWERCASE;
16994 static const StyleTextTransform CAPITALIZE;
16995 static const StyleTextTransform MATH_AUTO;
16996 static const StyleTextTransform CASE_TRANSFORMS;
16997 static const StyleTextTransform FULL_WIDTH;
16998 static const StyleTextTransform FULL_SIZE_KANA;
16999};
17000/// none
17001constexpr inline const StyleTextTransform StyleTextTransform::NONE = StyleTextTransform{ /* ._0 = */ (uint8_t)0 };
17002/// All uppercase.
17003constexpr inline const StyleTextTransform StyleTextTransform::UPPERCASE = StyleTextTransform{ /* ._0 = */ (uint8_t)(1 << 0) };
17004/// All lowercase.
17005constexpr inline const StyleTextTransform StyleTextTransform::LOWERCASE = StyleTextTransform{ /* ._0 = */ (uint8_t)(1 << 1) };
17006/// Capitalize each word.
17007constexpr inline const StyleTextTransform StyleTextTransform::CAPITALIZE = StyleTextTransform{ /* ._0 = */ (uint8_t)(1 << 2) };
17008/// Automatic italicization of math variables.
17009constexpr inline const StyleTextTransform StyleTextTransform::MATH_AUTO = StyleTextTransform{ /* ._0 = */ (uint8_t)(1 << 3) };
17010/// All the case transforms, which are exclusive with each other.
17011constexpr inline const StyleTextTransform StyleTextTransform::CASE_TRANSFORMS = StyleTextTransform{ /* ._0 = */ (uint8_t)((((StyleTextTransform::UPPERCASE)._0 | (StyleTextTransform::LOWERCASE)._0) | (StyleTextTransform::CAPITALIZE)._0) | (StyleTextTransform::MATH_AUTO)._0) };
17012/// full-width
17013constexpr inline const StyleTextTransform StyleTextTransform::FULL_WIDTH = StyleTextTransform{ /* ._0 = */ (uint8_t)(1 << 4) };
17014/// full-size-kana
17015constexpr inline const StyleTextTransform StyleTextTransform::FULL_SIZE_KANA = StyleTextTransform{ /* ._0 = */ (uint8_t)(1 << 5) };
17016
17017/// A CSS string stored as an `Atom`.
17018using StyleAtomString = StyleAtom;
17019
17020/// A generic value for the `text-overflow` property.
17021struct StyleTextOverflowSide {
17022 enum class Tag : uint8_t {
17023 /// Clip inline content.
17024 Clip,
17025 /// Render ellipsis to represent clipped inline content.
17026 Ellipsis,
17027 /// Render a given string to represent clipped inline content.
17028 String,
17029 };
17030
17031 struct StyleString_Body {
17032 StyleAtomString _0;
17033
17034 bool operator==(const StyleString_Body& other) const {
17035 return _0 == other._0;
17036 }
17037 bool operator!=(const StyleString_Body& other) const {
17038 return _0 != other._0;
17039 }
17040 };
17041
17042 Tag tag;
17043 union {
17044 StyleString_Body string;
17045 };
17046
17047 static StyleTextOverflowSide Clip() {
17048 StyleTextOverflowSide result;
17049 result.tag = Tag::Clip;
17050 return result;
17051 }
17052
17053 bool IsClip() const {
17054 return tag == Tag::Clip;
17055 }
17056
17057 static StyleTextOverflowSide Ellipsis() {
17058 StyleTextOverflowSide result;
17059 result.tag = Tag::Ellipsis;
17060 return result;
17061 }
17062
17063 bool IsEllipsis() const {
17064 return tag == Tag::Ellipsis;
17065 }
17066
17067 static StyleTextOverflowSide String(const StyleAtomString &_0) {
17068 StyleTextOverflowSide result;
17069 ::new (&result.string._0) (StyleAtomString)(_0);
17070 result.tag = Tag::String;
17071 return result;
17072 }
17073
17074 bool IsString() const {
17075 return tag == Tag::String;
17076 }
17077
17078 const StyleAtomString& AsString() const {
17079 MOZ_DIAGNOSTIC_ASSERT(IsString())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsString())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsString()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsString()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 17079); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsString()"
")"); do { *((volatile int*)__null) = 17079; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
17080 return string._0;
17081 }
17082
17083 bool operator==(const StyleTextOverflowSide& other) const {
17084 if (tag != other.tag) {
17085 return false;
17086 }
17087 switch (tag) {
17088 case Tag::String: return string == other.string;
17089 default: break;
17090 }
17091 return true;
17092 }
17093
17094 bool operator!=(const StyleTextOverflowSide& other) const {
17095 return !(*this == other);
17096 }
17097
17098 private:
17099 StyleTextOverflowSide() {
17100
17101 }
17102 public:
17103
17104
17105 ~StyleTextOverflowSide() {
17106 switch (tag) {
17107 case Tag::String: string.~StyleString_Body(); break;
17108 default: break;
17109 }
17110 }
17111
17112 StyleTextOverflowSide(const StyleTextOverflowSide& other)
17113 : tag(other.tag) {
17114 switch (tag) {
17115 case Tag::String: ::new (&string) (StyleString_Body)(other.string); break;
17116 default: break;
17117 }
17118 }
17119 StyleTextOverflowSide& operator=(const StyleTextOverflowSide& other) {
17120 if (this != &other) {
17121 this->~StyleTextOverflowSide();
17122 new (this) StyleTextOverflowSide(other);
17123 }
17124 return *this;
17125 }
17126};
17127
17128/// text-overflow.
17129/// When the specified value only has one side, that's the "second"
17130/// side, and the sides are logical, so "second" means "end". The
17131/// start side is Clip in that case.
17132///
17133/// When the specified value has two sides, those are our "first"
17134/// and "second" sides, and they are physical sides ("left" and
17135/// "right").
17136struct StyleTextOverflow {
17137 /// First side
17138 StyleTextOverflowSide first;
17139 /// Second side
17140 StyleTextOverflowSide second;
17141 /// True if the specified value only has one side.
17142 bool sides_are_logical;
17143
17144 bool operator==(const StyleTextOverflow& other) const {
17145 return first == other.first &&
17146 second == other.second &&
17147 sides_are_logical == other.sides_are_logical;
17148 }
17149 bool operator!=(const StyleTextOverflow& other) const {
17150 return first != other.first ||
17151 second != other.second ||
17152 sides_are_logical != other.sides_are_logical;
17153 }
17154 StyleTextOverflow()
17155 : first(StyleTextOverflowSide::Clip()),
17156 second(StyleTextOverflowSide::Clip()),
17157 sides_are_logical(true) {}
17158};
17159
17160/// Implements type for text-indent
17161/// which takes the grammar of [<length-percentage>] && hanging? && each-line?
17162///
17163/// https://drafts.csswg.org/css-text/#propdef-text-indent
17164template<typename LengthPercentage>
17165struct StyleGenericTextIndent {
17166 /// The amount of indent to be applied to the inline-start of the first line.
17167 LengthPercentage length;
17168 /// Apply indent to non-first lines instead of first.
17169 bool hanging;
17170 /// Apply to each line after a hard break, not only first in block.
17171 bool each_line;
17172
17173 bool operator==(const StyleGenericTextIndent& other) const {
17174 return length == other.length &&
17175 hanging == other.hanging &&
17176 each_line == other.each_line;
17177 }
17178 bool operator!=(const StyleGenericTextIndent& other) const {
17179 return length != other.length ||
17180 hanging != other.hanging ||
17181 each_line != other.each_line;
17182 }
17183 StyleGenericTextIndent()
17184 : length(StyleLengthPercentage::Zero()),
17185 hanging(false),
17186 each_line(false) {}
17187};
17188
17189/// The computed value of `text-indent`.
17190using StyleTextIndent = StyleGenericTextIndent<StyleLengthPercentage>;
17191
17192/// A generic value for `scrollbar-color` property.
17193///
17194/// https://drafts.csswg.org/css-scrollbars-1/#scrollbar-color
17195template<typename Color>
17196struct StyleGenericScrollbarColor {
17197 enum class Tag : uint8_t {
17198 /// `auto`
17199 Auto,
17200 /// `<color>{2}`
17201 Colors,
17202 };
17203
17204 struct StyleColors_Body {
17205 /// First `<color>`, for color of the scrollbar thumb.
17206 Color thumb;
17207 /// Second `<color>`, for color of the scrollbar track.
17208 Color track;
17209
17210 bool operator==(const StyleColors_Body& other) const {
17211 return thumb == other.thumb &&
17212 track == other.track;
17213 }
17214 bool operator!=(const StyleColors_Body& other) const {
17215 return thumb != other.thumb ||
17216 track != other.track;
17217 }
17218 };
17219
17220 Tag tag;
17221 union {
17222 StyleColors_Body colors;
17223 };
17224
17225 static StyleGenericScrollbarColor Auto() {
17226 StyleGenericScrollbarColor result;
17227 result.tag = Tag::Auto;
17228 return result;
17229 }
17230
17231 bool IsAuto() const {
17232 return tag == Tag::Auto;
17233 }
17234
17235 static StyleGenericScrollbarColor Colors(const Color &thumb,
17236 const Color &track) {
17237 StyleGenericScrollbarColor result;
17238 ::new (&result.colors.thumb) (Color)(thumb);
17239 ::new (&result.colors.track) (Color)(track);
17240 result.tag = Tag::Colors;
17241 return result;
17242 }
17243
17244 bool IsColors() const {
17245 return tag == Tag::Colors;
17246 }
17247
17248 const StyleColors_Body& AsColors() const {
17249 MOZ_DIAGNOSTIC_ASSERT(IsColors())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsColors())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsColors()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsColors()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 17249); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsColors()"
")"); do { *((volatile int*)__null) = 17249; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
17250 return colors;
17251 }
17252
17253 bool operator==(const StyleGenericScrollbarColor& other) const {
17254 if (tag != other.tag) {
17255 return false;
17256 }
17257 switch (tag) {
17258 case Tag::Colors: return colors == other.colors;
17259 default: break;
17260 }
17261 return true;
17262 }
17263
17264 bool operator!=(const StyleGenericScrollbarColor& other) const {
17265 return !(*this == other);
17266 }
17267
17268 private:
17269 StyleGenericScrollbarColor() {
17270
17271 }
17272 public:
17273
17274
17275 ~StyleGenericScrollbarColor() {
17276 switch (tag) {
17277 case Tag::Colors: colors.~StyleColors_Body(); break;
17278 default: break;
17279 }
17280 }
17281
17282 StyleGenericScrollbarColor(const StyleGenericScrollbarColor& other)
17283 : tag(other.tag) {
17284 switch (tag) {
17285 case Tag::Colors: ::new (&colors) (StyleColors_Body)(other.colors); break;
17286 default: break;
17287 }
17288 }
17289 StyleGenericScrollbarColor& operator=(const StyleGenericScrollbarColor& other) {
17290 if (this != &other) {
17291 this->~StyleGenericScrollbarColor();
17292 new (this) StyleGenericScrollbarColor(other);
17293 }
17294 return *this;
17295 }
17296};
17297
17298/// A computed value for `scrollbar-color` property.
17299using StyleScrollbarColor = StyleGenericScrollbarColor<StyleColor>;
17300
17301/// Either `<color>` or `auto`.
17302template<typename C>
17303struct StyleGenericColorOrAuto {
17304 enum class Tag : uint8_t {
17305 /// A `<color>`.
17306 Color,
17307 /// `auto`
17308 Auto,
17309 };
17310
17311 struct StyleColor_Body {
17312 C _0;
17313
17314 bool operator==(const StyleColor_Body& other) const {
17315 return _0 == other._0;
17316 }
17317 bool operator!=(const StyleColor_Body& other) const {
17318 return _0 != other._0;
17319 }
17320 };
17321
17322 Tag tag;
17323 union {
17324 StyleColor_Body color;
17325 };
17326
17327 static StyleGenericColorOrAuto Color(const C &_0) {
17328 StyleGenericColorOrAuto result;
17329 ::new (&result.color._0) (C)(_0);
17330 result.tag = Tag::Color;
17331 return result;
17332 }
17333
17334 bool IsColor() const {
17335 return tag == Tag::Color;
17336 }
17337
17338 const C& AsColor() const {
17339 MOZ_DIAGNOSTIC_ASSERT(IsColor())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsColor())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsColor()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsColor()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 17339); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsColor()"
")"); do { *((volatile int*)__null) = 17339; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
17340 return color._0;
17341 }
17342
17343 static StyleGenericColorOrAuto Auto() {
17344 StyleGenericColorOrAuto result;
17345 result.tag = Tag::Auto;
17346 return result;
17347 }
17348
17349 bool IsAuto() const {
17350 return tag == Tag::Auto;
17351 }
17352
17353 bool operator==(const StyleGenericColorOrAuto& other) const {
17354 if (tag != other.tag) {
17355 return false;
17356 }
17357 switch (tag) {
17358 case Tag::Color: return color == other.color;
17359 default: break;
17360 }
17361 return true;
17362 }
17363
17364 bool operator!=(const StyleGenericColorOrAuto& other) const {
17365 return !(*this == other);
17366 }
17367
17368 private:
17369 StyleGenericColorOrAuto() {
17370
17371 }
17372 public:
17373
17374
17375 ~StyleGenericColorOrAuto() {
17376 switch (tag) {
17377 case Tag::Color: color.~StyleColor_Body(); break;
17378 default: break;
17379 }
17380 }
17381
17382 StyleGenericColorOrAuto(const StyleGenericColorOrAuto& other)
17383 : tag(other.tag) {
17384 switch (tag) {
17385 case Tag::Color: ::new (&color) (StyleColor_Body)(other.color); break;
17386 default: break;
17387 }
17388 }
17389 StyleGenericColorOrAuto& operator=(const StyleGenericColorOrAuto& other) {
17390 if (this != &other) {
17391 this->~StyleGenericColorOrAuto();
17392 new (this) StyleGenericColorOrAuto(other);
17393 }
17394 return *this;
17395 }
17396};
17397
17398/// Caret color is effectively a ColorOrAuto, but resolves `auto` to
17399/// currentColor.
17400template<typename C>
17401using StyleGenericCaretColor = StyleGenericColorOrAuto<C>;
17402
17403/// caret-color
17404using StyleCaretColor = StyleGenericCaretColor<StyleColor>;
17405
17406/// auto | <color>
17407using StyleColorOrAuto = StyleGenericColorOrAuto<StyleColor>;
17408
17409/// A generic value for the `vertical-align` property.
17410template<typename LengthPercentage>
17411struct StyleGenericVerticalAlign {
17412 enum class Tag : uint8_t {
17413 /// One of the vertical-align keywords.
17414 Keyword,
17415 /// `<length-percentage>`
17416 Length,
17417 };
17418
17419 struct StyleKeyword_Body {
17420 StyleVerticalAlignKeyword _0;
17421
17422 bool operator==(const StyleKeyword_Body& other) const {
17423 return _0 == other._0;
17424 }
17425 bool operator!=(const StyleKeyword_Body& other) const {
17426 return _0 != other._0;
17427 }
17428 };
17429
17430 struct StyleLength_Body {
17431 LengthPercentage _0;
17432
17433 bool operator==(const StyleLength_Body& other) const {
17434 return _0 == other._0;
17435 }
17436 bool operator!=(const StyleLength_Body& other) const {
17437 return _0 != other._0;
17438 }
17439 };
17440
17441 Tag tag;
17442 union {
17443 StyleKeyword_Body keyword;
17444 StyleLength_Body length;
17445 };
17446
17447 static StyleGenericVerticalAlign Keyword(const StyleVerticalAlignKeyword &_0) {
17448 StyleGenericVerticalAlign result;
17449 ::new (&result.keyword._0) (StyleVerticalAlignKeyword)(_0);
17450 result.tag = Tag::Keyword;
17451 return result;
17452 }
17453
17454 bool IsKeyword() const {
17455 return tag == Tag::Keyword;
17456 }
17457
17458 const StyleVerticalAlignKeyword& AsKeyword() const {
17459 MOZ_DIAGNOSTIC_ASSERT(IsKeyword())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsKeyword())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsKeyword()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsKeyword()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 17459); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsKeyword()"
")"); do { *((volatile int*)__null) = 17459; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
17460 return keyword._0;
17461 }
17462
17463 static StyleGenericVerticalAlign Length(const LengthPercentage &_0) {
17464 StyleGenericVerticalAlign result;
17465 ::new (&result.length._0) (LengthPercentage)(_0);
17466 result.tag = Tag::Length;
17467 return result;
17468 }
17469
17470 bool IsLength() const {
17471 return tag == Tag::Length;
17472 }
17473
17474 const LengthPercentage& AsLength() const {
17475 MOZ_DIAGNOSTIC_ASSERT(IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLength()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 17475); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLength()"
")"); do { *((volatile int*)__null) = 17475; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
17476 return length._0;
17477 }
17478
17479 bool operator==(const StyleGenericVerticalAlign& other) const {
17480 if (tag != other.tag) {
17481 return false;
17482 }
17483 switch (tag) {
17484 case Tag::Keyword: return keyword == other.keyword;
17485 case Tag::Length: return length == other.length;
17486
17487 }
17488 return true;
17489 }
17490
17491 bool operator!=(const StyleGenericVerticalAlign& other) const {
17492 return !(*this == other);
17493 }
17494
17495 private:
17496 StyleGenericVerticalAlign() {
17497
17498 }
17499 public:
17500
17501
17502 ~StyleGenericVerticalAlign() {
17503 switch (tag) {
17504 case Tag::Keyword: keyword.~StyleKeyword_Body(); break;
17505 case Tag::Length: length.~StyleLength_Body(); break;
17506
17507 }
17508 }
17509
17510 StyleGenericVerticalAlign(const StyleGenericVerticalAlign& other)
17511 : tag(other.tag) {
17512 switch (tag) {
17513 case Tag::Keyword: ::new (&keyword) (StyleKeyword_Body)(other.keyword); break;
17514 case Tag::Length: ::new (&length) (StyleLength_Body)(other.length); break;
17515
17516 }
17517 }
17518 StyleGenericVerticalAlign& operator=(const StyleGenericVerticalAlign& other) {
17519 if (this != &other) {
17520 this->~StyleGenericVerticalAlign();
17521 new (this) StyleGenericVerticalAlign(other);
17522 }
17523 return *this;
17524 }
17525};
17526
17527/// A computed value for the `vertical-align` property.
17528using StyleVerticalAlign = StyleGenericVerticalAlign<StyleLengthPercentage>;
17529
17530/// The computed value of `ShapeRadius`.
17531using StyleShapeRadius = StyleGenericShapeRadius<StyleNonNegativeLengthPercentage>;
17532
17533/// The computed value of `ShapeCommand`.
17534using StyleShapeCommand = StyleGenericShapeCommand<StyleAngle, StyleLengthPercentage>;
17535
17536/// The inner pointer of an ArcSlice<T>, to be sent via FFI.
17537/// The type of the pointer is a bit of a lie, we just want to preserve the type
17538/// but these pointers cannot be constructed outside of this crate, so we're
17539/// good.
17540template<typename T>
17541struct StyleForgottenArcSlicePtr {
17542 T *_0;
17543
17544 bool operator==(const StyleForgottenArcSlicePtr& other) const {
17545 return _0 == other._0;
17546 }
17547 bool operator!=(const StyleForgottenArcSlicePtr& other) const {
17548 return _0 != other._0;
17549 }
17550};
17551
17552/// The context properties we understand.
17553struct StyleContextPropertyBits {
17554 uint8_t _0;
17555
17556 constexpr explicit operator bool() const {
17557 return !!_0;
17558 }
17559 constexpr StyleContextPropertyBits operator~() const {
17560 return StyleContextPropertyBits { static_cast<decltype(_0)>(~_0) };
17561 }
17562 constexpr StyleContextPropertyBits operator|(const StyleContextPropertyBits& other) const {
17563 return StyleContextPropertyBits { static_cast<decltype(_0)>(this->_0 | other._0) };
17564 }
17565 StyleContextPropertyBits& operator|=(const StyleContextPropertyBits& other) {
17566 *this = (*this | other);
17567 return *this;
17568 }
17569 constexpr StyleContextPropertyBits operator&(const StyleContextPropertyBits& other) const {
17570 return StyleContextPropertyBits { static_cast<decltype(_0)>(this->_0 & other._0) };
17571 }
17572 StyleContextPropertyBits& operator&=(const StyleContextPropertyBits& other) {
17573 *this = (*this & other);
17574 return *this;
17575 }
17576 constexpr StyleContextPropertyBits operator^(const StyleContextPropertyBits& other) const {
17577 return StyleContextPropertyBits { static_cast<decltype(_0)>(this->_0 ^ other._0) };
17578 }
17579 StyleContextPropertyBits& operator^=(const StyleContextPropertyBits& other) {
17580 *this = (*this ^ other);
17581 return *this;
17582 }
17583 bool operator==(const StyleContextPropertyBits& other) const {
17584 return _0 == other._0;
17585 }
17586 bool operator!=(const StyleContextPropertyBits& other) const {
17587 return _0 != other._0;
17588 }
17589 static const StyleContextPropertyBits FILL;
17590 static const StyleContextPropertyBits STROKE;
17591 static const StyleContextPropertyBits FILL_OPACITY;
17592 static const StyleContextPropertyBits STROKE_OPACITY;
17593};
17594/// `fill`
17595constexpr inline const StyleContextPropertyBits StyleContextPropertyBits::FILL = StyleContextPropertyBits{ /* ._0 = */ (uint8_t)(1 << 0) };
17596/// `stroke`
17597constexpr inline const StyleContextPropertyBits StyleContextPropertyBits::STROKE = StyleContextPropertyBits{ /* ._0 = */ (uint8_t)(1 << 1) };
17598/// `fill-opacity`
17599constexpr inline const StyleContextPropertyBits StyleContextPropertyBits::FILL_OPACITY = StyleContextPropertyBits{ /* ._0 = */ (uint8_t)(1 << 2) };
17600/// `stroke-opacity`
17601constexpr inline const StyleContextPropertyBits StyleContextPropertyBits::STROKE_OPACITY = StyleContextPropertyBits{ /* ._0 = */ (uint8_t)(1 << 3) };
17602
17603/// Specified MozContextProperties value.
17604/// Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-context-properties)
17605struct StyleMozContextProperties {
17606 StyleArcSlice<StyleCustomIdent> idents;
17607 StyleContextPropertyBits bits;
17608
17609 bool operator==(const StyleMozContextProperties& other) const {
17610 return idents == other.idents &&
17611 bits == other.bits;
17612 }
17613 bool operator!=(const StyleMozContextProperties& other) const {
17614 return idents != other.idents ||
17615 bits != other.bits;
17616 }
17617};
17618
17619/// A quote pair.
17620struct StyleQuotePair {
17621 /// The opening quote.
17622 StyleOwnedStr opening;
17623 /// The closing quote.
17624 StyleOwnedStr closing;
17625
17626 bool operator==(const StyleQuotePair& other) const {
17627 return opening == other.opening &&
17628 closing == other.closing;
17629 }
17630 bool operator!=(const StyleQuotePair& other) const {
17631 return opening != other.opening ||
17632 closing != other.closing;
17633 }
17634};
17635
17636/// List of quote pairs for the specified/computed value of `quotes` property.
17637using StyleQuoteList = StyleArcSlice<StyleQuotePair>;
17638
17639/// Specified and computed `quotes` property: `auto`, `none`, or a list
17640/// of characters.
17641struct StyleQuotes {
17642 enum class Tag {
17643 /// list of quote pairs
17644 QuoteList,
17645 /// auto (use lang-dependent quote marks)
17646 Auto,
17647 };
17648
17649 struct StyleQuoteList_Body {
17650 StyleQuoteList _0;
17651
17652 bool operator==(const StyleQuoteList_Body& other) const {
17653 return _0 == other._0;
17654 }
17655 bool operator!=(const StyleQuoteList_Body& other) const {
17656 return _0 != other._0;
17657 }
17658 };
17659
17660 Tag tag;
17661 union {
17662 StyleQuoteList_Body quote_list;
17663 };
17664
17665 static StyleQuotes QuoteList(const StyleQuoteList &_0) {
17666 StyleQuotes result;
17667 ::new (&result.quote_list._0) (StyleQuoteList)(_0);
17668 result.tag = Tag::QuoteList;
17669 return result;
17670 }
17671
17672 bool IsQuoteList() const {
17673 return tag == Tag::QuoteList;
17674 }
17675
17676 const StyleQuoteList& AsQuoteList() const {
17677 MOZ_DIAGNOSTIC_ASSERT(IsQuoteList())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsQuoteList())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsQuoteList()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsQuoteList()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 17677); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsQuoteList()"
")"); do { *((volatile int*)__null) = 17677; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
17678 return quote_list._0;
17679 }
17680
17681 static StyleQuotes Auto() {
17682 StyleQuotes result;
17683 result.tag = Tag::Auto;
17684 return result;
17685 }
17686
17687 bool IsAuto() const {
17688 return tag == Tag::Auto;
17689 }
17690
17691 bool operator==(const StyleQuotes& other) const {
17692 if (tag != other.tag) {
17693 return false;
17694 }
17695 switch (tag) {
17696 case Tag::QuoteList: return quote_list == other.quote_list;
17697 default: break;
17698 }
17699 return true;
17700 }
17701
17702 bool operator!=(const StyleQuotes& other) const {
17703 return !(*this == other);
17704 }
17705
17706 private:
17707 StyleQuotes() {
17708
17709 }
17710 public:
17711
17712
17713 ~StyleQuotes() {
17714 switch (tag) {
17715 case Tag::QuoteList: quote_list.~StyleQuoteList_Body(); break;
17716 default: break;
17717 }
17718 }
17719
17720 StyleQuotes(const StyleQuotes& other)
17721 : tag(other.tag) {
17722 switch (tag) {
17723 case Tag::QuoteList: ::new (&quote_list) (StyleQuoteList_Body)(other.quote_list); break;
17724 default: break;
17725 }
17726 }
17727 StyleQuotes& operator=(const StyleQuotes& other) {
17728 if (this != &other) {
17729 this->~StyleQuotes();
17730 new (this) StyleQuotes(other);
17731 }
17732 return *this;
17733 }
17734};
17735
17736/// A generic value for a single `box-shadow`.
17737template<typename Color, typename SizeLength, typename BlurShapeLength, typename ShapeLength>
17738struct StyleGenericBoxShadow {
17739 /// The base shadow.
17740 StyleGenericSimpleShadow<Color, SizeLength, BlurShapeLength> base;
17741 /// The spread radius.
17742 ShapeLength spread;
17743 /// Whether this is an inset box shadow.
17744 bool inset;
17745
17746 bool operator==(const StyleGenericBoxShadow& other) const {
17747 return base == other.base &&
17748 spread == other.spread &&
17749 inset == other.inset;
17750 }
17751 bool operator!=(const StyleGenericBoxShadow& other) const {
17752 return base != other.base ||
17753 spread != other.spread ||
17754 inset != other.inset;
17755 }
17756};
17757
17758/// A computed value for a single shadow of the `box-shadow` property.
17759using StyleBoxShadow = StyleGenericBoxShadow<StyleColor, StyleLength, StyleNonNegativeLength, StyleLength>;
17760
17761/// A generic value for a single side of a `border-image-width` property.
17762template<typename LP, typename N>
17763struct StyleGenericBorderImageSideWidth {
17764 enum class Tag : uint8_t {
17765 /// `<number>`
17766 ///
17767 /// NOTE: Numbers need to be before length-percentagess, in order to parse
17768 /// them first, since `0` should be a number, not the `0px` length.
17769 Number,
17770 /// `<length-or-percentage>`
17771 LengthPercentage,
17772 /// `auto`
17773 Auto,
17774 };
17775
17776 struct StyleNumber_Body {
17777 N _0;
17778
17779 bool operator==(const StyleNumber_Body& other) const {
17780 return _0 == other._0;
17781 }
17782 bool operator!=(const StyleNumber_Body& other) const {
17783 return _0 != other._0;
17784 }
17785 };
17786
17787 struct StyleLengthPercentage_Body {
17788 LP _0;
17789
17790 bool operator==(const StyleLengthPercentage_Body& other) const {
17791 return _0 == other._0;
17792 }
17793 bool operator!=(const StyleLengthPercentage_Body& other) const {
17794 return _0 != other._0;
17795 }
17796 };
17797
17798 Tag tag;
17799 union {
17800 StyleNumber_Body number;
17801 StyleLengthPercentage_Body length_percentage;
17802 };
17803
17804 static StyleGenericBorderImageSideWidth Number(const N &_0) {
17805 StyleGenericBorderImageSideWidth result;
17806 ::new (&result.number._0) (N)(_0);
17807 result.tag = Tag::Number;
17808 return result;
17809 }
17810
17811 bool IsNumber() const {
17812 return tag == Tag::Number;
17813 }
17814
17815 const N& AsNumber() const {
17816 MOZ_DIAGNOSTIC_ASSERT(IsNumber())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsNumber())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsNumber()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsNumber()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 17816); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsNumber()"
")"); do { *((volatile int*)__null) = 17816; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
17817 return number._0;
17818 }
17819
17820 static StyleGenericBorderImageSideWidth LengthPercentage(const LP &_0) {
17821 StyleGenericBorderImageSideWidth result;
17822 ::new (&result.length_percentage._0) (LP)(_0);
17823 result.tag = Tag::LengthPercentage;
17824 return result;
17825 }
17826
17827 bool IsLengthPercentage() const {
17828 return tag == Tag::LengthPercentage;
17829 }
17830
17831 const LP& AsLengthPercentage() const {
17832 MOZ_DIAGNOSTIC_ASSERT(IsLengthPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLengthPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLengthPercentage()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsLengthPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 17832); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLengthPercentage()"
")"); do { *((volatile int*)__null) = 17832; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
17833 return length_percentage._0;
17834 }
17835
17836 static StyleGenericBorderImageSideWidth Auto() {
17837 StyleGenericBorderImageSideWidth result;
17838 result.tag = Tag::Auto;
17839 return result;
17840 }
17841
17842 bool IsAuto() const {
17843 return tag == Tag::Auto;
17844 }
17845
17846 bool operator==(const StyleGenericBorderImageSideWidth& other) const {
17847 if (tag != other.tag) {
17848 return false;
17849 }
17850 switch (tag) {
17851 case Tag::Number: return number == other.number;
17852 case Tag::LengthPercentage: return length_percentage == other.length_percentage;
17853 default: break;
17854 }
17855 return true;
17856 }
17857
17858 bool operator!=(const StyleGenericBorderImageSideWidth& other) const {
17859 return !(*this == other);
17860 }
17861
17862 private:
17863 StyleGenericBorderImageSideWidth() {
17864
17865 }
17866 public:
17867
17868
17869 ~StyleGenericBorderImageSideWidth() {
17870 switch (tag) {
17871 case Tag::Number: number.~StyleNumber_Body(); break;
17872 case Tag::LengthPercentage: length_percentage.~StyleLengthPercentage_Body(); break;
17873 default: break;
17874 }
17875 }
17876
17877 StyleGenericBorderImageSideWidth(const StyleGenericBorderImageSideWidth& other)
17878 : tag(other.tag) {
17879 switch (tag) {
17880 case Tag::Number: ::new (&number) (StyleNumber_Body)(other.number); break;
17881 case Tag::LengthPercentage: ::new (&length_percentage) (StyleLengthPercentage_Body)(other.length_percentage); break;
17882 default: break;
17883 }
17884 }
17885 StyleGenericBorderImageSideWidth& operator=(const StyleGenericBorderImageSideWidth& other) {
17886 if (this != &other) {
17887 this->~StyleGenericBorderImageSideWidth();
17888 new (this) StyleGenericBorderImageSideWidth(other);
17889 }
17890 return *this;
17891 }
17892};
17893
17894/// A computed value for a single side of a `border-image-width` property.
17895using StyleBorderImageSideWidth = StyleGenericBorderImageSideWidth<StyleNonNegativeLengthPercentage, StyleNonNegativeNumber>;
17896
17897/// A computed value for the `border-image-width` property.
17898using StyleBorderImageWidth = StyleRect<StyleBorderImageSideWidth>;
17899
17900#if defined(CBINDGEN_IS_GECKO)
17901/// The computed value of a CSS image `url()`.
17902using StyleComputedImageUrl = StyleComputedUrl;
17903#endif
17904
17905/// An image url or none, used for example in list-style-image
17906template<typename U>
17907struct StyleGenericUrlOrNone {
17908 enum class Tag : uint8_t {
17909 /// `none`
17910 None,
17911 /// A URL.
17912 Url,
17913 };
17914
17915 struct StyleUrl_Body {
17916 U _0;
17917
17918 bool operator==(const StyleUrl_Body& other) const {
17919 return _0 == other._0;
17920 }
17921 bool operator!=(const StyleUrl_Body& other) const {
17922 return _0 != other._0;
17923 }
17924 };
17925
17926 Tag tag;
17927 union {
17928 StyleUrl_Body url;
17929 };
17930
17931 static StyleGenericUrlOrNone None() {
17932 StyleGenericUrlOrNone result;
17933 result.tag = Tag::None;
17934 return result;
17935 }
17936
17937 bool IsNone() const {
17938 return tag == Tag::None;
17939 }
17940
17941 static StyleGenericUrlOrNone Url(const U &_0) {
17942 StyleGenericUrlOrNone result;
17943 ::new (&result.url._0) (U)(_0);
17944 result.tag = Tag::Url;
17945 return result;
17946 }
17947
17948 bool IsUrl() const {
17949 return tag == Tag::Url;
17950 }
17951
17952 const U& AsUrl() const {
17953 MOZ_DIAGNOSTIC_ASSERT(IsUrl())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsUrl())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsUrl()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsUrl()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 17953); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsUrl()"
")"); do { *((volatile int*)__null) = 17953; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
17954 return url._0;
17955 }
17956
17957 bool operator==(const StyleGenericUrlOrNone& other) const {
17958 if (tag != other.tag) {
17959 return false;
17960 }
17961 switch (tag) {
17962 case Tag::Url: return url == other.url;
17963 default: break;
17964 }
17965 return true;
17966 }
17967
17968 bool operator!=(const StyleGenericUrlOrNone& other) const {
17969 return !(*this == other);
17970 }
17971
17972 private:
17973 StyleGenericUrlOrNone() {
17974
17975 }
17976 public:
17977
17978
17979 ~StyleGenericUrlOrNone() {
17980 switch (tag) {
17981 case Tag::Url: url.~StyleUrl_Body(); break;
17982 default: break;
17983 }
17984 }
17985
17986 StyleGenericUrlOrNone(const StyleGenericUrlOrNone& other)
17987 : tag(other.tag) {
17988 switch (tag) {
17989 case Tag::Url: ::new (&url) (StyleUrl_Body)(other.url); break;
17990 default: break;
17991 }
17992 }
17993 StyleGenericUrlOrNone& operator=(const StyleGenericUrlOrNone& other) {
17994 if (this != &other) {
17995 this->~StyleGenericUrlOrNone();
17996 new (this) StyleGenericUrlOrNone(other);
17997 }
17998 return *this;
17999 }
18000};
18001
18002/// Computed <url> | <none>
18003using StyleUrlOrNone = StyleGenericUrlOrNone<StyleComputedUrl>;
18004
18005/// A computed gradient line direction.
18006struct StyleLineDirection {
18007 enum class Tag : uint8_t {
18008 /// An angle.
18009 Angle,
18010 /// A horizontal direction.
18011 Horizontal,
18012 /// A vertical direction.
18013 Vertical,
18014 /// A corner.
18015 Corner,
18016 };
18017
18018 struct StyleAngle_Body {
18019 StyleAngle _0;
18020
18021 bool operator==(const StyleAngle_Body& other) const {
18022 return _0 == other._0;
18023 }
18024 bool operator!=(const StyleAngle_Body& other) const {
18025 return _0 != other._0;
18026 }
18027 };
18028
18029 struct StyleHorizontal_Body {
18030 StyleHorizontalPositionKeyword _0;
18031
18032 bool operator==(const StyleHorizontal_Body& other) const {
18033 return _0 == other._0;
18034 }
18035 bool operator!=(const StyleHorizontal_Body& other) const {
18036 return _0 != other._0;
18037 }
18038 };
18039
18040 struct StyleVertical_Body {
18041 StyleVerticalPositionKeyword _0;
18042
18043 bool operator==(const StyleVertical_Body& other) const {
18044 return _0 == other._0;
18045 }
18046 bool operator!=(const StyleVertical_Body& other) const {
18047 return _0 != other._0;
18048 }
18049 };
18050
18051 struct StyleCorner_Body {
18052 StyleHorizontalPositionKeyword _0;
18053 StyleVerticalPositionKeyword _1;
18054
18055 bool operator==(const StyleCorner_Body& other) const {
18056 return _0 == other._0 &&
18057 _1 == other._1;
18058 }
18059 bool operator!=(const StyleCorner_Body& other) const {
18060 return _0 != other._0 ||
18061 _1 != other._1;
18062 }
18063 };
18064
18065 Tag tag;
18066 union {
18067 StyleAngle_Body angle;
18068 StyleHorizontal_Body horizontal;
18069 StyleVertical_Body vertical;
18070 StyleCorner_Body corner;
18071 };
18072
18073 static StyleLineDirection Angle(const StyleAngle &_0) {
18074 StyleLineDirection result;
18075 ::new (&result.angle._0) (StyleAngle)(_0);
18076 result.tag = Tag::Angle;
18077 return result;
18078 }
18079
18080 bool IsAngle() const {
18081 return tag == Tag::Angle;
18082 }
18083
18084 const StyleAngle& AsAngle() const {
18085 MOZ_DIAGNOSTIC_ASSERT(IsAngle())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAngle())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAngle()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsAngle()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18085); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAngle()"
")"); do { *((volatile int*)__null) = 18085; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18086 return angle._0;
18087 }
18088
18089 static StyleLineDirection Horizontal(const StyleHorizontalPositionKeyword &_0) {
18090 StyleLineDirection result;
18091 ::new (&result.horizontal._0) (StyleHorizontalPositionKeyword)(_0);
18092 result.tag = Tag::Horizontal;
18093 return result;
18094 }
18095
18096 bool IsHorizontal() const {
18097 return tag == Tag::Horizontal;
18098 }
18099
18100 const StyleHorizontalPositionKeyword& AsHorizontal() const {
18101 MOZ_DIAGNOSTIC_ASSERT(IsHorizontal())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsHorizontal())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsHorizontal()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsHorizontal()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18101); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsHorizontal()"
")"); do { *((volatile int*)__null) = 18101; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18102 return horizontal._0;
18103 }
18104
18105 static StyleLineDirection Vertical(const StyleVerticalPositionKeyword &_0) {
18106 StyleLineDirection result;
18107 ::new (&result.vertical._0) (StyleVerticalPositionKeyword)(_0);
18108 result.tag = Tag::Vertical;
18109 return result;
18110 }
18111
18112 bool IsVertical() const {
18113 return tag == Tag::Vertical;
18114 }
18115
18116 const StyleVerticalPositionKeyword& AsVertical() const {
18117 MOZ_DIAGNOSTIC_ASSERT(IsVertical())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsVertical())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsVertical()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsVertical()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18117); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsVertical()"
")"); do { *((volatile int*)__null) = 18117; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18118 return vertical._0;
18119 }
18120
18121 static StyleLineDirection Corner(const StyleHorizontalPositionKeyword &_0,
18122 const StyleVerticalPositionKeyword &_1) {
18123 StyleLineDirection result;
18124 ::new (&result.corner._0) (StyleHorizontalPositionKeyword)(_0);
18125 ::new (&result.corner._1) (StyleVerticalPositionKeyword)(_1);
18126 result.tag = Tag::Corner;
18127 return result;
18128 }
18129
18130 bool IsCorner() const {
18131 return tag == Tag::Corner;
18132 }
18133
18134 const StyleCorner_Body& AsCorner() const {
18135 MOZ_DIAGNOSTIC_ASSERT(IsCorner())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCorner())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCorner()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsCorner()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18135); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCorner()"
")"); do { *((volatile int*)__null) = 18135; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18136 return corner;
18137 }
18138
18139 bool operator==(const StyleLineDirection& other) const {
18140 if (tag != other.tag) {
18141 return false;
18142 }
18143 switch (tag) {
18144 case Tag::Angle: return angle == other.angle;
18145 case Tag::Horizontal: return horizontal == other.horizontal;
18146 case Tag::Vertical: return vertical == other.vertical;
18147 case Tag::Corner: return corner == other.corner;
18148
18149 }
18150 return true;
18151 }
18152
18153 bool operator!=(const StyleLineDirection& other) const {
18154 return !(*this == other);
18155 }
18156
18157 private:
18158 StyleLineDirection() {
18159
18160 }
18161 public:
18162
18163
18164 ~StyleLineDirection() {
18165 switch (tag) {
18166 case Tag::Angle: angle.~StyleAngle_Body(); break;
18167 case Tag::Horizontal: horizontal.~StyleHorizontal_Body(); break;
18168 case Tag::Vertical: vertical.~StyleVertical_Body(); break;
18169 case Tag::Corner: corner.~StyleCorner_Body(); break;
18170
18171 }
18172 }
18173
18174 StyleLineDirection(const StyleLineDirection& other)
18175 : tag(other.tag) {
18176 switch (tag) {
18177 case Tag::Angle: ::new (&angle) (StyleAngle_Body)(other.angle); break;
18178 case Tag::Horizontal: ::new (&horizontal) (StyleHorizontal_Body)(other.horizontal); break;
18179 case Tag::Vertical: ::new (&vertical) (StyleVertical_Body)(other.vertical); break;
18180 case Tag::Corner: ::new (&corner) (StyleCorner_Body)(other.corner); break;
18181
18182 }
18183 }
18184 StyleLineDirection& operator=(const StyleLineDirection& other) {
18185 if (this != &other) {
18186 this->~StyleLineDirection();
18187 new (this) StyleLineDirection(other);
18188 }
18189 return *this;
18190 }
18191};
18192
18193struct StyleAngleOrPercentage {
18194 enum class Tag : uint8_t {
18195 Percentage,
18196 Angle,
18197 };
18198
18199 struct StylePercentage_Body {
18200 StylePercentage _0;
18201
18202 bool operator==(const StylePercentage_Body& other) const {
18203 return _0 == other._0;
18204 }
18205 bool operator!=(const StylePercentage_Body& other) const {
18206 return _0 != other._0;
18207 }
18208 };
18209
18210 struct StyleAngle_Body {
18211 StyleAngle _0;
18212
18213 bool operator==(const StyleAngle_Body& other) const {
18214 return _0 == other._0;
18215 }
18216 bool operator!=(const StyleAngle_Body& other) const {
18217 return _0 != other._0;
18218 }
18219 };
18220
18221 Tag tag;
18222 union {
18223 StylePercentage_Body percentage;
18224 StyleAngle_Body angle;
18225 };
18226
18227 static StyleAngleOrPercentage Percentage(const StylePercentage &_0) {
18228 StyleAngleOrPercentage result;
18229 ::new (&result.percentage._0) (StylePercentage)(_0);
18230 result.tag = Tag::Percentage;
18231 return result;
18232 }
18233
18234 bool IsPercentage() const {
18235 return tag == Tag::Percentage;
18236 }
18237
18238 const StylePercentage& AsPercentage() const {
18239 MOZ_DIAGNOSTIC_ASSERT(IsPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPercentage()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18239); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPercentage()"
")"); do { *((volatile int*)__null) = 18239; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18240 return percentage._0;
18241 }
18242
18243 static StyleAngleOrPercentage Angle(const StyleAngle &_0) {
18244 StyleAngleOrPercentage result;
18245 ::new (&result.angle._0) (StyleAngle)(_0);
18246 result.tag = Tag::Angle;
18247 return result;
18248 }
18249
18250 bool IsAngle() const {
18251 return tag == Tag::Angle;
18252 }
18253
18254 const StyleAngle& AsAngle() const {
18255 MOZ_DIAGNOSTIC_ASSERT(IsAngle())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAngle())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAngle()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsAngle()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18255); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAngle()"
")"); do { *((volatile int*)__null) = 18255; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18256 return angle._0;
18257 }
18258
18259 bool operator==(const StyleAngleOrPercentage& other) const {
18260 if (tag != other.tag) {
18261 return false;
18262 }
18263 switch (tag) {
18264 case Tag::Percentage: return percentage == other.percentage;
18265 case Tag::Angle: return angle == other.angle;
18266
18267 }
18268 return true;
18269 }
18270
18271 bool operator!=(const StyleAngleOrPercentage& other) const {
18272 return !(*this == other);
18273 }
18274
18275 private:
18276 StyleAngleOrPercentage() {
18277
18278 }
18279 public:
18280
18281
18282 ~StyleAngleOrPercentage() {
18283 switch (tag) {
18284 case Tag::Percentage: percentage.~StylePercentage_Body(); break;
18285 case Tag::Angle: angle.~StyleAngle_Body(); break;
18286
18287 }
18288 }
18289
18290 StyleAngleOrPercentage(const StyleAngleOrPercentage& other)
18291 : tag(other.tag) {
18292 switch (tag) {
18293 case Tag::Percentage: ::new (&percentage) (StylePercentage_Body)(other.percentage); break;
18294 case Tag::Angle: ::new (&angle) (StyleAngle_Body)(other.angle); break;
18295
18296 }
18297 }
18298 StyleAngleOrPercentage& operator=(const StyleAngleOrPercentage& other) {
18299 if (this != &other) {
18300 this->~StyleAngleOrPercentage();
18301 new (this) StyleAngleOrPercentage(other);
18302 }
18303 return *this;
18304 }
18305};
18306
18307/// A gradient item.
18308/// <https://drafts.csswg.org/css-images-4/#color-stop-syntax>
18309template<typename Color, typename T>
18310struct StyleGenericGradientItem {
18311 enum class Tag : uint8_t {
18312 /// A simple color stop, without position.
18313 SimpleColorStop,
18314 /// A complex color stop, with a position.
18315 ComplexColorStop,
18316 /// An interpolation hint.
18317 InterpolationHint,
18318 };
18319
18320 struct StyleSimpleColorStop_Body {
18321 Color _0;
18322
18323 bool operator==(const StyleSimpleColorStop_Body& other) const {
18324 return _0 == other._0;
18325 }
18326 bool operator!=(const StyleSimpleColorStop_Body& other) const {
18327 return _0 != other._0;
18328 }
18329 };
18330
18331 struct StyleComplexColorStop_Body {
18332 /// The color for the stop.
18333 Color color;
18334 /// The position for the stop.
18335 T position;
18336
18337 bool operator==(const StyleComplexColorStop_Body& other) const {
18338 return color == other.color &&
18339 position == other.position;
18340 }
18341 bool operator!=(const StyleComplexColorStop_Body& other) const {
18342 return color != other.color ||
18343 position != other.position;
18344 }
18345 };
18346
18347 struct StyleInterpolationHint_Body {
18348 T _0;
18349
18350 bool operator==(const StyleInterpolationHint_Body& other) const {
18351 return _0 == other._0;
18352 }
18353 bool operator!=(const StyleInterpolationHint_Body& other) const {
18354 return _0 != other._0;
18355 }
18356 };
18357
18358 Tag tag;
18359 union {
18360 StyleSimpleColorStop_Body simple_color_stop;
18361 StyleComplexColorStop_Body complex_color_stop;
18362 StyleInterpolationHint_Body interpolation_hint;
18363 };
18364
18365 static StyleGenericGradientItem SimpleColorStop(const Color &_0) {
18366 StyleGenericGradientItem result;
18367 ::new (&result.simple_color_stop._0) (Color)(_0);
18368 result.tag = Tag::SimpleColorStop;
18369 return result;
18370 }
18371
18372 bool IsSimpleColorStop() const {
18373 return tag == Tag::SimpleColorStop;
18374 }
18375
18376 const Color& AsSimpleColorStop() const {
18377 MOZ_DIAGNOSTIC_ASSERT(IsSimpleColorStop())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSimpleColorStop())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSimpleColorStop()))), 0)))
{ do { } while (false); MOZ_ReportAssertionFailure("IsSimpleColorStop()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18377); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSimpleColorStop()"
")"); do { *((volatile int*)__null) = 18377; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18378 return simple_color_stop._0;
18379 }
18380
18381 static StyleGenericGradientItem ComplexColorStop(const Color &color,
18382 const T &position) {
18383 StyleGenericGradientItem result;
18384 ::new (&result.complex_color_stop.color) (Color)(color);
18385 ::new (&result.complex_color_stop.position) (T)(position);
18386 result.tag = Tag::ComplexColorStop;
18387 return result;
18388 }
18389
18390 bool IsComplexColorStop() const {
18391 return tag == Tag::ComplexColorStop;
18392 }
18393
18394 const StyleComplexColorStop_Body& AsComplexColorStop() const {
18395 MOZ_DIAGNOSTIC_ASSERT(IsComplexColorStop())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsComplexColorStop())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsComplexColorStop()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsComplexColorStop()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18395); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsComplexColorStop()"
")"); do { *((volatile int*)__null) = 18395; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18396 return complex_color_stop;
18397 }
18398
18399 static StyleGenericGradientItem InterpolationHint(const T &_0) {
18400 StyleGenericGradientItem result;
18401 ::new (&result.interpolation_hint._0) (T)(_0);
18402 result.tag = Tag::InterpolationHint;
18403 return result;
18404 }
18405
18406 bool IsInterpolationHint() const {
18407 return tag == Tag::InterpolationHint;
18408 }
18409
18410 const T& AsInterpolationHint() const {
18411 MOZ_DIAGNOSTIC_ASSERT(IsInterpolationHint())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsInterpolationHint())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsInterpolationHint()))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("IsInterpolationHint()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18411); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsInterpolationHint()"
")"); do { *((volatile int*)__null) = 18411; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18412 return interpolation_hint._0;
18413 }
18414
18415 bool operator==(const StyleGenericGradientItem& other) const {
18416 if (tag != other.tag) {
18417 return false;
18418 }
18419 switch (tag) {
18420 case Tag::SimpleColorStop: return simple_color_stop == other.simple_color_stop;
18421 case Tag::ComplexColorStop: return complex_color_stop == other.complex_color_stop;
18422 case Tag::InterpolationHint: return interpolation_hint == other.interpolation_hint;
18423
18424 }
18425 return true;
18426 }
18427
18428 bool operator!=(const StyleGenericGradientItem& other) const {
18429 return !(*this == other);
18430 }
18431
18432 private:
18433 StyleGenericGradientItem() {
18434
18435 }
18436 public:
18437
18438
18439 ~StyleGenericGradientItem() {
18440 switch (tag) {
18441 case Tag::SimpleColorStop: simple_color_stop.~StyleSimpleColorStop_Body(); break;
18442 case Tag::ComplexColorStop: complex_color_stop.~StyleComplexColorStop_Body(); break;
18443 case Tag::InterpolationHint: interpolation_hint.~StyleInterpolationHint_Body(); break;
18444
18445 }
18446 }
18447
18448 StyleGenericGradientItem(const StyleGenericGradientItem& other)
18449 : tag(other.tag) {
18450 switch (tag) {
18451 case Tag::SimpleColorStop: ::new (&simple_color_stop) (StyleSimpleColorStop_Body)(other.simple_color_stop); break;
18452 case Tag::ComplexColorStop: ::new (&complex_color_stop) (StyleComplexColorStop_Body)(other.complex_color_stop); break;
18453 case Tag::InterpolationHint: ::new (&interpolation_hint) (StyleInterpolationHint_Body)(other.interpolation_hint); break;
18454
18455 }
18456 }
18457 StyleGenericGradientItem& operator=(const StyleGenericGradientItem& other) {
18458 if (this != &other) {
18459 this->~StyleGenericGradientItem();
18460 new (this) StyleGenericGradientItem(other);
18461 }
18462 return *this;
18463 }
18464};
18465
18466/// State flags stored on each variant of a Gradient.
18467struct StyleGradientFlags {
18468 uint8_t _0;
18469
18470 constexpr explicit operator bool() const {
18471 return !!_0;
18472 }
18473 constexpr StyleGradientFlags operator~() const {
18474 return StyleGradientFlags { static_cast<decltype(_0)>(~_0) };
18475 }
18476 constexpr StyleGradientFlags operator|(const StyleGradientFlags& other) const {
18477 return StyleGradientFlags { static_cast<decltype(_0)>(this->_0 | other._0) };
18478 }
18479 StyleGradientFlags& operator|=(const StyleGradientFlags& other) {
18480 *this = (*this | other);
18481 return *this;
18482 }
18483 constexpr StyleGradientFlags operator&(const StyleGradientFlags& other) const {
18484 return StyleGradientFlags { static_cast<decltype(_0)>(this->_0 & other._0) };
18485 }
18486 StyleGradientFlags& operator&=(const StyleGradientFlags& other) {
18487 *this = (*this & other);
18488 return *this;
18489 }
18490 constexpr StyleGradientFlags operator^(const StyleGradientFlags& other) const {
18491 return StyleGradientFlags { static_cast<decltype(_0)>(this->_0 ^ other._0) };
18492 }
18493 StyleGradientFlags& operator^=(const StyleGradientFlags& other) {
18494 *this = (*this ^ other);
18495 return *this;
18496 }
18497 bool operator==(const StyleGradientFlags& other) const {
18498 return _0 == other._0;
18499 }
18500 bool operator!=(const StyleGradientFlags& other) const {
18501 return _0 != other._0;
18502 }
18503 static const StyleGradientFlags REPEATING;
18504 static const StyleGradientFlags HAS_DEFAULT_COLOR_INTERPOLATION_METHOD;
18505};
18506/// Set if this is a repeating gradient.
18507constexpr inline const StyleGradientFlags StyleGradientFlags::REPEATING = StyleGradientFlags{ /* ._0 = */ (uint8_t)(1 << 0) };
18508/// Set if the color interpolation method matches the default for the items.
18509constexpr inline const StyleGradientFlags StyleGradientFlags::HAS_DEFAULT_COLOR_INTERPOLATION_METHOD = StyleGradientFlags{ /* ._0 = */ (uint8_t)(1 << 1) };
18510
18511/// A circle shape.
18512template<typename NonNegativeLength>
18513struct StyleGenericCircle {
18514 enum class Tag : uint8_t {
18515 /// A circle radius.
18516 Radius,
18517 /// A circle extent.
18518 Extent,
18519 };
18520
18521 struct StyleRadius_Body {
18522 NonNegativeLength _0;
18523
18524 bool operator==(const StyleRadius_Body& other) const {
18525 return _0 == other._0;
18526 }
18527 bool operator!=(const StyleRadius_Body& other) const {
18528 return _0 != other._0;
18529 }
18530 };
18531
18532 struct StyleExtent_Body {
18533 StyleShapeExtent _0;
18534
18535 bool operator==(const StyleExtent_Body& other) const {
18536 return _0 == other._0;
18537 }
18538 bool operator!=(const StyleExtent_Body& other) const {
18539 return _0 != other._0;
18540 }
18541 };
18542
18543 Tag tag;
18544 union {
18545 StyleRadius_Body radius;
18546 StyleExtent_Body extent;
18547 };
18548
18549 static StyleGenericCircle Radius(const NonNegativeLength &_0) {
18550 StyleGenericCircle result;
18551 ::new (&result.radius._0) (NonNegativeLength)(_0);
18552 result.tag = Tag::Radius;
18553 return result;
18554 }
18555
18556 bool IsRadius() const {
18557 return tag == Tag::Radius;
18558 }
18559
18560 const NonNegativeLength& AsRadius() const {
18561 MOZ_DIAGNOSTIC_ASSERT(IsRadius())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRadius())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRadius()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsRadius()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18561); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRadius()"
")"); do { *((volatile int*)__null) = 18561; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18562 return radius._0;
18563 }
18564
18565 static StyleGenericCircle Extent(const StyleShapeExtent &_0) {
18566 StyleGenericCircle result;
18567 ::new (&result.extent._0) (StyleShapeExtent)(_0);
18568 result.tag = Tag::Extent;
18569 return result;
18570 }
18571
18572 bool IsExtent() const {
18573 return tag == Tag::Extent;
18574 }
18575
18576 const StyleShapeExtent& AsExtent() const {
18577 MOZ_DIAGNOSTIC_ASSERT(IsExtent())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsExtent())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsExtent()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsExtent()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18577); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsExtent()"
")"); do { *((volatile int*)__null) = 18577; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18578 return extent._0;
18579 }
18580
18581 bool operator==(const StyleGenericCircle& other) const {
18582 if (tag != other.tag) {
18583 return false;
18584 }
18585 switch (tag) {
18586 case Tag::Radius: return radius == other.radius;
18587 case Tag::Extent: return extent == other.extent;
18588
18589 }
18590 return true;
18591 }
18592
18593 bool operator!=(const StyleGenericCircle& other) const {
18594 return !(*this == other);
18595 }
18596
18597 private:
18598 StyleGenericCircle() {
18599
18600 }
18601 public:
18602
18603
18604 ~StyleGenericCircle() {
18605 switch (tag) {
18606 case Tag::Radius: radius.~StyleRadius_Body(); break;
18607 case Tag::Extent: extent.~StyleExtent_Body(); break;
18608
18609 }
18610 }
18611
18612 StyleGenericCircle(const StyleGenericCircle& other)
18613 : tag(other.tag) {
18614 switch (tag) {
18615 case Tag::Radius: ::new (&radius) (StyleRadius_Body)(other.radius); break;
18616 case Tag::Extent: ::new (&extent) (StyleExtent_Body)(other.extent); break;
18617
18618 }
18619 }
18620 StyleGenericCircle& operator=(const StyleGenericCircle& other) {
18621 if (this != &other) {
18622 this->~StyleGenericCircle();
18623 new (this) StyleGenericCircle(other);
18624 }
18625 return *this;
18626 }
18627};
18628
18629/// An ellipse shape.
18630template<typename NonNegativeLengthPercentage>
18631struct StyleGenericEllipse {
18632 enum class Tag : uint8_t {
18633 /// An ellipse pair of radii.
18634 Radii,
18635 /// An ellipse extent.
18636 Extent,
18637 };
18638
18639 struct StyleRadii_Body {
18640 NonNegativeLengthPercentage _0;
18641 NonNegativeLengthPercentage _1;
18642
18643 bool operator==(const StyleRadii_Body& other) const {
18644 return _0 == other._0 &&
18645 _1 == other._1;
18646 }
18647 bool operator!=(const StyleRadii_Body& other) const {
18648 return _0 != other._0 ||
18649 _1 != other._1;
18650 }
18651 };
18652
18653 struct StyleExtent_Body {
18654 StyleShapeExtent _0;
18655
18656 bool operator==(const StyleExtent_Body& other) const {
18657 return _0 == other._0;
18658 }
18659 bool operator!=(const StyleExtent_Body& other) const {
18660 return _0 != other._0;
18661 }
18662 };
18663
18664 Tag tag;
18665 union {
18666 StyleRadii_Body radii;
18667 StyleExtent_Body extent;
18668 };
18669
18670 static StyleGenericEllipse Radii(const NonNegativeLengthPercentage &_0,
18671 const NonNegativeLengthPercentage &_1) {
18672 StyleGenericEllipse result;
18673 ::new (&result.radii._0) (NonNegativeLengthPercentage)(_0);
18674 ::new (&result.radii._1) (NonNegativeLengthPercentage)(_1);
18675 result.tag = Tag::Radii;
18676 return result;
18677 }
18678
18679 bool IsRadii() const {
18680 return tag == Tag::Radii;
18681 }
18682
18683 const StyleRadii_Body& AsRadii() const {
18684 MOZ_DIAGNOSTIC_ASSERT(IsRadii())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRadii())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRadii()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsRadii()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18684); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRadii()"
")"); do { *((volatile int*)__null) = 18684; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18685 return radii;
18686 }
18687
18688 static StyleGenericEllipse Extent(const StyleShapeExtent &_0) {
18689 StyleGenericEllipse result;
18690 ::new (&result.extent._0) (StyleShapeExtent)(_0);
18691 result.tag = Tag::Extent;
18692 return result;
18693 }
18694
18695 bool IsExtent() const {
18696 return tag == Tag::Extent;
18697 }
18698
18699 const StyleShapeExtent& AsExtent() const {
18700 MOZ_DIAGNOSTIC_ASSERT(IsExtent())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsExtent())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsExtent()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsExtent()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18700); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsExtent()"
")"); do { *((volatile int*)__null) = 18700; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18701 return extent._0;
18702 }
18703
18704 bool operator==(const StyleGenericEllipse& other) const {
18705 if (tag != other.tag) {
18706 return false;
18707 }
18708 switch (tag) {
18709 case Tag::Radii: return radii == other.radii;
18710 case Tag::Extent: return extent == other.extent;
18711
18712 }
18713 return true;
18714 }
18715
18716 bool operator!=(const StyleGenericEllipse& other) const {
18717 return !(*this == other);
18718 }
18719
18720 private:
18721 StyleGenericEllipse() {
18722
18723 }
18724 public:
18725
18726
18727 ~StyleGenericEllipse() {
18728 switch (tag) {
18729 case Tag::Radii: radii.~StyleRadii_Body(); break;
18730 case Tag::Extent: extent.~StyleExtent_Body(); break;
18731
18732 }
18733 }
18734
18735 StyleGenericEllipse(const StyleGenericEllipse& other)
18736 : tag(other.tag) {
18737 switch (tag) {
18738 case Tag::Radii: ::new (&radii) (StyleRadii_Body)(other.radii); break;
18739 case Tag::Extent: ::new (&extent) (StyleExtent_Body)(other.extent); break;
18740
18741 }
18742 }
18743 StyleGenericEllipse& operator=(const StyleGenericEllipse& other) {
18744 if (this != &other) {
18745 this->~StyleGenericEllipse();
18746 new (this) StyleGenericEllipse(other);
18747 }
18748 return *this;
18749 }
18750};
18751
18752/// A radial gradient's ending shape.
18753template<typename NonNegativeLength, typename NonNegativeLengthPercentage>
18754struct StyleGenericEndingShape {
18755 enum class Tag : uint8_t {
18756 /// A circular gradient.
18757 Circle,
18758 /// An elliptic gradient.
18759 Ellipse,
18760 };
18761
18762 struct StyleCircle_Body {
18763 StyleGenericCircle<NonNegativeLength> _0;
18764
18765 bool operator==(const StyleCircle_Body& other) const {
18766 return _0 == other._0;
18767 }
18768 bool operator!=(const StyleCircle_Body& other) const {
18769 return _0 != other._0;
18770 }
18771 };
18772
18773 struct StyleEllipse_Body {
18774 StyleGenericEllipse<NonNegativeLengthPercentage> _0;
18775
18776 bool operator==(const StyleEllipse_Body& other) const {
18777 return _0 == other._0;
18778 }
18779 bool operator!=(const StyleEllipse_Body& other) const {
18780 return _0 != other._0;
18781 }
18782 };
18783
18784 Tag tag;
18785 union {
18786 StyleCircle_Body circle;
18787 StyleEllipse_Body ellipse;
18788 };
18789
18790 static StyleGenericEndingShape Circle(const StyleGenericCircle<NonNegativeLength> &_0) {
18791 StyleGenericEndingShape result;
18792 ::new (&result.circle._0) (StyleGenericCircle<NonNegativeLength>)(_0);
18793 result.tag = Tag::Circle;
18794 return result;
18795 }
18796
18797 bool IsCircle() const {
18798 return tag == Tag::Circle;
18799 }
18800
18801 const StyleGenericCircle<NonNegativeLength>& AsCircle() const {
18802 MOZ_DIAGNOSTIC_ASSERT(IsCircle())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCircle())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCircle()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsCircle()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18802); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCircle()"
")"); do { *((volatile int*)__null) = 18802; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18803 return circle._0;
18804 }
18805
18806 static StyleGenericEndingShape Ellipse(const StyleGenericEllipse<NonNegativeLengthPercentage> &_0) {
18807 StyleGenericEndingShape result;
18808 ::new (&result.ellipse._0) (StyleGenericEllipse<NonNegativeLengthPercentage>)(_0);
18809 result.tag = Tag::Ellipse;
18810 return result;
18811 }
18812
18813 bool IsEllipse() const {
18814 return tag == Tag::Ellipse;
18815 }
18816
18817 const StyleGenericEllipse<NonNegativeLengthPercentage>& AsEllipse() const {
18818 MOZ_DIAGNOSTIC_ASSERT(IsEllipse())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsEllipse())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsEllipse()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsEllipse()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18818); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsEllipse()"
")"); do { *((volatile int*)__null) = 18818; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18819 return ellipse._0;
18820 }
18821
18822 bool operator==(const StyleGenericEndingShape& other) const {
18823 if (tag != other.tag) {
18824 return false;
18825 }
18826 switch (tag) {
18827 case Tag::Circle: return circle == other.circle;
18828 case Tag::Ellipse: return ellipse == other.ellipse;
18829
18830 }
18831 return true;
18832 }
18833
18834 bool operator!=(const StyleGenericEndingShape& other) const {
18835 return !(*this == other);
18836 }
18837
18838 private:
18839 StyleGenericEndingShape() {
18840
18841 }
18842 public:
18843
18844
18845 ~StyleGenericEndingShape() {
18846 switch (tag) {
18847 case Tag::Circle: circle.~StyleCircle_Body(); break;
18848 case Tag::Ellipse: ellipse.~StyleEllipse_Body(); break;
18849
18850 }
18851 }
18852
18853 StyleGenericEndingShape(const StyleGenericEndingShape& other)
18854 : tag(other.tag) {
18855 switch (tag) {
18856 case Tag::Circle: ::new (&circle) (StyleCircle_Body)(other.circle); break;
18857 case Tag::Ellipse: ::new (&ellipse) (StyleEllipse_Body)(other.ellipse); break;
18858
18859 }
18860 }
18861 StyleGenericEndingShape& operator=(const StyleGenericEndingShape& other) {
18862 if (this != &other) {
18863 this->~StyleGenericEndingShape();
18864 new (this) StyleGenericEndingShape(other);
18865 }
18866 return *this;
18867 }
18868};
18869
18870/// A CSS gradient.
18871/// <https://drafts.csswg.org/css-images/#gradients>
18872template<typename LineDirection, typename LengthPercentage, typename NonNegativeLength, typename NonNegativeLengthPercentage, typename Position, typename Angle, typename AngleOrPercentage, typename Color>
18873struct StyleGenericGradient {
18874 enum class Tag {
18875 /// A linear gradient.
18876 Linear,
18877 /// A radial gradient.
18878 Radial,
18879 /// A conic gradient.
18880 Conic,
18881 };
18882
18883 struct StyleLinear_Body {
18884 /// Line direction
18885 LineDirection direction;
18886 /// Method to use for color interpolation.
18887 StyleColorInterpolationMethod color_interpolation_method;
18888 /// The color stops and interpolation hints.
18889 StyleOwnedSlice<StyleGenericGradientItem<Color, LengthPercentage>> items;
18890 /// State flags for the gradient.
18891 StyleGradientFlags flags;
18892 /// Compatibility mode.
18893 StyleGradientCompatMode compat_mode;
18894
18895 bool operator==(const StyleLinear_Body& other) const {
18896 return direction == other.direction &&
18897 color_interpolation_method == other.color_interpolation_method &&
18898 items == other.items &&
18899 flags == other.flags &&
18900 compat_mode == other.compat_mode;
18901 }
18902 bool operator!=(const StyleLinear_Body& other) const {
18903 return direction != other.direction ||
18904 color_interpolation_method != other.color_interpolation_method ||
18905 items != other.items ||
18906 flags != other.flags ||
18907 compat_mode != other.compat_mode;
18908 }
18909 };
18910
18911 struct StyleRadial_Body {
18912 /// Shape of gradient
18913 StyleGenericEndingShape<NonNegativeLength, NonNegativeLengthPercentage> shape;
18914 /// Center of gradient
18915 Position position;
18916 /// Method to use for color interpolation.
18917 StyleColorInterpolationMethod color_interpolation_method;
18918 /// The color stops and interpolation hints.
18919 StyleOwnedSlice<StyleGenericGradientItem<Color, LengthPercentage>> items;
18920 /// State flags for the gradient.
18921 StyleGradientFlags flags;
18922 /// Compatibility mode.
18923 StyleGradientCompatMode compat_mode;
18924
18925 bool operator==(const StyleRadial_Body& other) const {
18926 return shape == other.shape &&
18927 position == other.position &&
18928 color_interpolation_method == other.color_interpolation_method &&
18929 items == other.items &&
18930 flags == other.flags &&
18931 compat_mode == other.compat_mode;
18932 }
18933 bool operator!=(const StyleRadial_Body& other) const {
18934 return shape != other.shape ||
18935 position != other.position ||
18936 color_interpolation_method != other.color_interpolation_method ||
18937 items != other.items ||
18938 flags != other.flags ||
18939 compat_mode != other.compat_mode;
18940 }
18941 };
18942
18943 struct StyleConic_Body {
18944 /// Start angle of gradient
18945 Angle angle;
18946 /// Center of gradient
18947 Position position;
18948 /// Method to use for color interpolation.
18949 StyleColorInterpolationMethod color_interpolation_method;
18950 /// The color stops and interpolation hints.
18951 StyleOwnedSlice<StyleGenericGradientItem<Color, AngleOrPercentage>> items;
18952 /// State flags for the gradient.
18953 StyleGradientFlags flags;
18954
18955 bool operator==(const StyleConic_Body& other) const {
18956 return angle == other.angle &&
18957 position == other.position &&
18958 color_interpolation_method == other.color_interpolation_method &&
18959 items == other.items &&
18960 flags == other.flags;
18961 }
18962 bool operator!=(const StyleConic_Body& other) const {
18963 return angle != other.angle ||
18964 position != other.position ||
18965 color_interpolation_method != other.color_interpolation_method ||
18966 items != other.items ||
18967 flags != other.flags;
18968 }
18969 };
18970
18971 Tag tag;
18972 union {
18973 StyleLinear_Body linear;
18974 StyleRadial_Body radial;
18975 StyleConic_Body conic;
18976 };
18977
18978 static StyleGenericGradient Linear(const LineDirection &direction,
18979 const StyleColorInterpolationMethod &color_interpolation_method,
18980 const StyleOwnedSlice<StyleGenericGradientItem<Color, LengthPercentage>> &items,
18981 const StyleGradientFlags &flags,
18982 const StyleGradientCompatMode &compat_mode) {
18983 StyleGenericGradient result;
18984 ::new (&result.linear.direction) (LineDirection)(direction);
18985 ::new (&result.linear.color_interpolation_method) (StyleColorInterpolationMethod)(color_interpolation_method);
18986 ::new (&result.linear.items) (StyleOwnedSlice<StyleGenericGradientItem<Color, LengthPercentage>>)(items);
18987 ::new (&result.linear.flags) (StyleGradientFlags)(flags);
18988 ::new (&result.linear.compat_mode) (StyleGradientCompatMode)(compat_mode);
18989 result.tag = Tag::Linear;
18990 return result;
18991 }
18992
18993 bool IsLinear() const {
18994 return tag == Tag::Linear;
18995 }
18996
18997 const StyleLinear_Body& AsLinear() const {
18998 MOZ_DIAGNOSTIC_ASSERT(IsLinear())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLinear())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLinear()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLinear()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 18998); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLinear()"
")"); do { *((volatile int*)__null) = 18998; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
18999 return linear;
19000 }
19001
19002 static StyleGenericGradient Radial(const StyleGenericEndingShape<NonNegativeLength, NonNegativeLengthPercentage> &shape,
19003 const Position &position,
19004 const StyleColorInterpolationMethod &color_interpolation_method,
19005 const StyleOwnedSlice<StyleGenericGradientItem<Color, LengthPercentage>> &items,
19006 const StyleGradientFlags &flags,
19007 const StyleGradientCompatMode &compat_mode) {
19008 StyleGenericGradient result;
19009 ::new (&result.radial.shape) (StyleGenericEndingShape<NonNegativeLength, NonNegativeLengthPercentage>)(shape);
19010 ::new (&result.radial.position) (Position)(position);
19011 ::new (&result.radial.color_interpolation_method) (StyleColorInterpolationMethod)(color_interpolation_method);
19012 ::new (&result.radial.items) (StyleOwnedSlice<StyleGenericGradientItem<Color, LengthPercentage>>)(items);
19013 ::new (&result.radial.flags) (StyleGradientFlags)(flags);
19014 ::new (&result.radial.compat_mode) (StyleGradientCompatMode)(compat_mode);
19015 result.tag = Tag::Radial;
19016 return result;
19017 }
19018
19019 bool IsRadial() const {
19020 return tag == Tag::Radial;
19021 }
19022
19023 const StyleRadial_Body& AsRadial() const {
19024 MOZ_DIAGNOSTIC_ASSERT(IsRadial())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRadial())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRadial()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsRadial()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19024); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRadial()"
")"); do { *((volatile int*)__null) = 19024; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19025 return radial;
19026 }
19027
19028 static StyleGenericGradient Conic(const Angle &angle,
19029 const Position &position,
19030 const StyleColorInterpolationMethod &color_interpolation_method,
19031 const StyleOwnedSlice<StyleGenericGradientItem<Color, AngleOrPercentage>> &items,
19032 const StyleGradientFlags &flags) {
19033 StyleGenericGradient result;
19034 ::new (&result.conic.angle) (Angle)(angle);
19035 ::new (&result.conic.position) (Position)(position);
19036 ::new (&result.conic.color_interpolation_method) (StyleColorInterpolationMethod)(color_interpolation_method);
19037 ::new (&result.conic.items) (StyleOwnedSlice<StyleGenericGradientItem<Color, AngleOrPercentage>>)(items);
19038 ::new (&result.conic.flags) (StyleGradientFlags)(flags);
19039 result.tag = Tag::Conic;
19040 return result;
19041 }
19042
19043 bool IsConic() const {
19044 return tag == Tag::Conic;
19045 }
19046
19047 const StyleConic_Body& AsConic() const {
19048 MOZ_DIAGNOSTIC_ASSERT(IsConic())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsConic())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsConic()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsConic()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19048); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsConic()"
")"); do { *((volatile int*)__null) = 19048; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19049 return conic;
19050 }
19051
19052 bool operator==(const StyleGenericGradient& other) const {
19053 if (tag != other.tag) {
19054 return false;
19055 }
19056 switch (tag) {
19057 case Tag::Linear: return linear == other.linear;
19058 case Tag::Radial: return radial == other.radial;
19059 case Tag::Conic: return conic == other.conic;
19060
19061 }
19062 return true;
19063 }
19064
19065 bool operator!=(const StyleGenericGradient& other) const {
19066 return !(*this == other);
19067 }
19068
19069 private:
19070 StyleGenericGradient() {
19071
19072 }
19073 public:
19074
19075
19076 ~StyleGenericGradient() {
19077 switch (tag) {
19078 case Tag::Linear: linear.~StyleLinear_Body(); break;
19079 case Tag::Radial: radial.~StyleRadial_Body(); break;
19080 case Tag::Conic: conic.~StyleConic_Body(); break;
19081
19082 }
19083 }
19084
19085 StyleGenericGradient(const StyleGenericGradient& other)
19086 : tag(other.tag) {
19087 switch (tag) {
19088 case Tag::Linear: ::new (&linear) (StyleLinear_Body)(other.linear); break;
19089 case Tag::Radial: ::new (&radial) (StyleRadial_Body)(other.radial); break;
19090 case Tag::Conic: ::new (&conic) (StyleConic_Body)(other.conic); break;
19091
19092 }
19093 }
19094 StyleGenericGradient& operator=(const StyleGenericGradient& other) {
19095 if (this != &other) {
19096 this->~StyleGenericGradient();
19097 new (this) StyleGenericGradient(other);
19098 }
19099 return *this;
19100 }
19101 inline bool Repeating() const;
19102 bool IsOpaque() const;
19103
19104 // Return the color interpolation method of the gradient.
19105 inline const StyleColorInterpolationMethod& ColorInterpolationMethod() const;
19106};
19107
19108/// Computed values for a CSS gradient.
19109/// <https://drafts.csswg.org/css-images/#gradients>
19110using StyleGradient = StyleGenericGradient<StyleLineDirection, StyleLengthPercentage, StyleNonNegativeLength, StyleNonNegativeLengthPercentage, StylePosition, StyleAngle, StyleAngleOrPercentage, StyleColor>;
19111
19112/// A range of rows or columns. Using this instead of std::ops::Range for FFI
19113/// purposes.
19114struct StyleUnsignedRange {
19115 /// The start of the range.
19116 uint32_t start;
19117 /// The end of the range.
19118 uint32_t end;
19119
19120 bool operator==(const StyleUnsignedRange& other) const {
19121 return start == other.start &&
19122 end == other.end;
19123 }
19124 bool operator!=(const StyleUnsignedRange& other) const {
19125 return start != other.start ||
19126 end != other.end;
19127 }
19128};
19129
19130/// Not associated with any particular grid item, but can be referenced from the
19131/// grid-placement properties.
19132struct StyleNamedArea {
19133 /// Name of the `named area`
19134 StyleAtom name;
19135 /// Rows of the `named area`
19136 StyleUnsignedRange rows;
19137 /// Columns of the `named area`
19138 StyleUnsignedRange columns;
19139
19140 bool operator==(const StyleNamedArea& other) const {
19141 return name == other.name &&
19142 rows == other.rows &&
19143 columns == other.columns;
19144 }
19145 bool operator!=(const StyleNamedArea& other) const {
19146 return name != other.name ||
19147 rows != other.rows ||
19148 columns != other.columns;
19149 }
19150};
19151
19152/// https://drafts.csswg.org/css-grid/#named-grid-area
19153struct StyleTemplateAreas {
19154 /// `named area` containing for each template area
19155 StyleOwnedSlice<StyleNamedArea> areas;
19156 /// The simplified CSS strings for serialization purpose.
19157 /// https://drafts.csswg.org/css-grid/#serialize-template
19158 StyleOwnedSlice<StyleOwnedStr> strings;
19159 /// The number of columns of the grid.
19160 uint32_t width;
19161
19162 bool operator==(const StyleTemplateAreas& other) const {
19163 return areas == other.areas &&
19164 strings == other.strings &&
19165 width == other.width;
19166 }
19167 bool operator!=(const StyleTemplateAreas& other) const {
19168 return areas != other.areas ||
19169 strings != other.strings ||
19170 width != other.width;
19171 }
19172};
19173
19174/// Arc type for `Arc<TemplateAreas>`
19175using StyleTemplateAreasArc = StyleArc<StyleTemplateAreas>;
19176
19177/// This property specifies named grid areas.
19178///
19179/// The syntax of this property also provides a visualization of the structure
19180/// of the grid, making the overall layout of the grid container easier to
19181/// understand.
19182struct StyleGridTemplateAreas {
19183 enum class Tag : uint8_t {
19184 /// The `none` value.
19185 None,
19186 /// The actual value.
19187 Areas,
19188 };
19189
19190 struct StyleAreas_Body {
19191 StyleTemplateAreasArc _0;
19192
19193 bool operator==(const StyleAreas_Body& other) const {
19194 return _0 == other._0;
19195 }
19196 bool operator!=(const StyleAreas_Body& other) const {
19197 return _0 != other._0;
19198 }
19199 };
19200
19201 Tag tag;
19202 union {
19203 StyleAreas_Body areas;
19204 };
19205
19206 static StyleGridTemplateAreas None() {
19207 StyleGridTemplateAreas result;
19208 result.tag = Tag::None;
19209 return result;
19210 }
19211
19212 bool IsNone() const {
19213 return tag == Tag::None;
19214 }
19215
19216 static StyleGridTemplateAreas Areas(const StyleTemplateAreasArc &_0) {
19217 StyleGridTemplateAreas result;
19218 ::new (&result.areas._0) (StyleTemplateAreasArc)(_0);
19219 result.tag = Tag::Areas;
19220 return result;
19221 }
19222
19223 bool IsAreas() const {
19224 return tag == Tag::Areas;
19225 }
19226
19227 const StyleTemplateAreasArc& AsAreas() const {
19228 MOZ_DIAGNOSTIC_ASSERT(IsAreas())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAreas())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAreas()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsAreas()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19228); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAreas()"
")"); do { *((volatile int*)__null) = 19228; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19229 return areas._0;
19230 }
19231
19232 bool operator==(const StyleGridTemplateAreas& other) const {
19233 if (tag != other.tag) {
19234 return false;
19235 }
19236 switch (tag) {
19237 case Tag::Areas: return areas == other.areas;
19238 default: break;
19239 }
19240 return true;
19241 }
19242
19243 bool operator!=(const StyleGridTemplateAreas& other) const {
19244 return !(*this == other);
19245 }
19246
19247 private:
19248 StyleGridTemplateAreas() {
19249
19250 }
19251 public:
19252
19253
19254 ~StyleGridTemplateAreas() {
19255 switch (tag) {
19256 case Tag::Areas: areas.~StyleAreas_Body(); break;
19257 default: break;
19258 }
19259 }
19260
19261 StyleGridTemplateAreas(const StyleGridTemplateAreas& other)
19262 : tag(other.tag) {
19263 switch (tag) {
19264 case Tag::Areas: ::new (&areas) (StyleAreas_Body)(other.areas); break;
19265 default: break;
19266 }
19267 }
19268 StyleGridTemplateAreas& operator=(const StyleGridTemplateAreas& other) {
19269 if (this != &other) {
19270 this->~StyleGridTemplateAreas();
19271 new (this) StyleGridTemplateAreas(other);
19272 }
19273 return *this;
19274 }
19275};
19276
19277/// A `<grid-line>` type.
19278///
19279/// <https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line>
19280template<typename Integer>
19281struct StyleGenericGridLine {
19282 /// A custom identifier for named lines, or the empty atom otherwise.
19283 ///
19284 /// <https://drafts.csswg.org/css-grid/#grid-placement-slot>
19285 StyleCustomIdent ident;
19286 /// Denotes the nth grid line from grid item's placement.
19287 ///
19288 /// This is clamped by MIN_GRID_LINE and MAX_GRID_LINE.
19289 ///
19290 /// NOTE(emilio): If we ever allow animating these we need to either do
19291 /// something more complicated for the clamping, or do this clamping at
19292 /// used-value time.
19293 Integer line_num;
19294 /// Flag to check whether it's a `span` keyword.
19295 bool is_span;
19296
19297 bool operator==(const StyleGenericGridLine& other) const {
19298 return ident == other.ident &&
19299 line_num == other.line_num &&
19300 is_span == other.is_span;
19301 }
19302 bool operator!=(const StyleGenericGridLine& other) const {
19303 return ident != other.ident ||
19304 line_num != other.line_num ||
19305 is_span != other.is_span;
19306 }
19307 // Returns the `auto` value.
19308 inline StyleGenericGridLine();
19309 inline bool IsAuto() const;
19310 // The line name, or nsGkAtoms::_empty if not present.
19311 inline nsAtom* LineName() const;
19312};
19313
19314/// The computed value of a `<grid-line>`.
19315using StyleGridLine = StyleGenericGridLine<StyleInteger>;
19316
19317/// A track breadth for explicit grid track sizing. It's generic solely to
19318/// avoid re-implementing it for the computed type.
19319///
19320/// <https://drafts.csswg.org/css-grid/#typedef-track-breadth>
19321template<typename L>
19322struct StyleGenericTrackBreadth {
19323 enum class Tag : uint8_t {
19324 /// The generic type is almost always a non-negative `<length-percentage>`
19325 Breadth,
19326 /// A flex fraction specified in `fr` units.
19327 Fr,
19328 /// `auto`
19329 Auto,
19330 /// `min-content`
19331 MinContent,
19332 /// `max-content`
19333 MaxContent,
19334 };
19335
19336 struct StyleBreadth_Body {
19337 L _0;
19338
19339 bool operator==(const StyleBreadth_Body& other) const {
19340 return _0 == other._0;
19341 }
19342 bool operator!=(const StyleBreadth_Body& other) const {
19343 return _0 != other._0;
19344 }
19345 };
19346
19347 struct StyleFr_Body {
19348 StyleCSSFloat _0;
19349
19350 bool operator==(const StyleFr_Body& other) const {
19351 return _0 == other._0;
19352 }
19353 bool operator!=(const StyleFr_Body& other) const {
19354 return _0 != other._0;
19355 }
19356 };
19357
19358 Tag tag;
19359 union {
19360 StyleBreadth_Body breadth;
19361 StyleFr_Body fr;
19362 };
19363
19364 static StyleGenericTrackBreadth Breadth(const L &_0) {
19365 StyleGenericTrackBreadth result;
19366 ::new (&result.breadth._0) (L)(_0);
19367 result.tag = Tag::Breadth;
19368 return result;
19369 }
19370
19371 bool IsBreadth() const {
19372 return tag == Tag::Breadth;
19373 }
19374
19375 const L& AsBreadth() const {
19376 MOZ_DIAGNOSTIC_ASSERT(IsBreadth())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsBreadth())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsBreadth()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsBreadth()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19376); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsBreadth()"
")"); do { *((volatile int*)__null) = 19376; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19377 return breadth._0;
19378 }
19379
19380 static StyleGenericTrackBreadth Fr(const StyleCSSFloat &_0) {
19381 StyleGenericTrackBreadth result;
19382 ::new (&result.fr._0) (StyleCSSFloat)(_0);
19383 result.tag = Tag::Fr;
19384 return result;
19385 }
19386
19387 bool IsFr() const {
19388 return tag == Tag::Fr;
19389 }
19390
19391 const StyleCSSFloat& AsFr() const {
19392 MOZ_DIAGNOSTIC_ASSERT(IsFr())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsFr())>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(IsFr()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsFr()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19392); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsFr()"
")"); do { *((volatile int*)__null) = 19392; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19393 return fr._0;
19394 }
19395
19396 static StyleGenericTrackBreadth Auto() {
19397 StyleGenericTrackBreadth result;
19398 result.tag = Tag::Auto;
19399 return result;
19400 }
19401
19402 bool IsAuto() const {
19403 return tag == Tag::Auto;
19404 }
19405
19406 static StyleGenericTrackBreadth MinContent() {
19407 StyleGenericTrackBreadth result;
19408 result.tag = Tag::MinContent;
19409 return result;
19410 }
19411
19412 bool IsMinContent() const {
19413 return tag == Tag::MinContent;
19414 }
19415
19416 static StyleGenericTrackBreadth MaxContent() {
19417 StyleGenericTrackBreadth result;
19418 result.tag = Tag::MaxContent;
19419 return result;
19420 }
19421
19422 bool IsMaxContent() const {
19423 return tag == Tag::MaxContent;
19424 }
19425
19426 bool operator==(const StyleGenericTrackBreadth& other) const {
19427 if (tag != other.tag) {
19428 return false;
19429 }
19430 switch (tag) {
19431 case Tag::Breadth: return breadth == other.breadth;
19432 case Tag::Fr: return fr == other.fr;
19433 default: break;
19434 }
19435 return true;
19436 }
19437
19438 bool operator!=(const StyleGenericTrackBreadth& other) const {
19439 return !(*this == other);
19440 }
19441
19442 private:
19443 StyleGenericTrackBreadth() {
19444
19445 }
19446 public:
19447
19448
19449 ~StyleGenericTrackBreadth() {
19450 switch (tag) {
19451 case Tag::Breadth: breadth.~StyleBreadth_Body(); break;
19452 case Tag::Fr: fr.~StyleFr_Body(); break;
19453 default: break;
19454 }
19455 }
19456
19457 StyleGenericTrackBreadth(const StyleGenericTrackBreadth& other)
19458 : tag(other.tag) {
19459 switch (tag) {
19460 case Tag::Breadth: ::new (&breadth) (StyleBreadth_Body)(other.breadth); break;
19461 case Tag::Fr: ::new (&fr) (StyleFr_Body)(other.fr); break;
19462 default: break;
19463 }
19464 }
19465 StyleGenericTrackBreadth& operator=(const StyleGenericTrackBreadth& other) {
19466 if (this != &other) {
19467 this->~StyleGenericTrackBreadth();
19468 new (this) StyleGenericTrackBreadth(other);
19469 }
19470 return *this;
19471 }
19472 inline bool HasPercent() const;
19473};
19474
19475/// A `<track-size>` type for explicit grid track sizing. Like `<track-breadth>`, this is
19476/// generic only to avoid code bloat. It only takes `<length-percentage>`
19477///
19478/// <https://drafts.csswg.org/css-grid/#typedef-track-size>
19479template<typename L>
19480struct StyleGenericTrackSize {
19481 enum class Tag : uint8_t {
19482 /// A flexible `<track-breadth>`
19483 Breadth,
19484 /// A `minmax` function for a range over an inflexible `<track-breadth>`
19485 /// and a flexible `<track-breadth>`
19486 ///
19487 /// <https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-minmax>
19488 Minmax,
19489 /// A `fit-content` function.
19490 ///
19491 /// This stores a TrackBreadth<L> for convenience, but it can only be a
19492 /// LengthPercentage.
19493 ///
19494 /// <https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-fit-content>
19495 FitContent,
19496 };
19497
19498 struct StyleBreadth_Body {
19499 StyleGenericTrackBreadth<L> _0;
19500
19501 bool operator==(const StyleBreadth_Body& other) const {
19502 return _0 == other._0;
19503 }
19504 bool operator!=(const StyleBreadth_Body& other) const {
19505 return _0 != other._0;
19506 }
19507 };
19508
19509 struct StyleMinmax_Body {
19510 StyleGenericTrackBreadth<L> _0;
19511 StyleGenericTrackBreadth<L> _1;
19512
19513 bool operator==(const StyleMinmax_Body& other) const {
19514 return _0 == other._0 &&
19515 _1 == other._1;
19516 }
19517 bool operator!=(const StyleMinmax_Body& other) const {
19518 return _0 != other._0 ||
19519 _1 != other._1;
19520 }
19521 };
19522
19523 struct StyleFitContent_Body {
19524 StyleGenericTrackBreadth<L> _0;
19525
19526 bool operator==(const StyleFitContent_Body& other) const {
19527 return _0 == other._0;
19528 }
19529 bool operator!=(const StyleFitContent_Body& other) const {
19530 return _0 != other._0;
19531 }
19532 };
19533
19534 Tag tag;
19535 union {
19536 StyleBreadth_Body breadth;
19537 StyleMinmax_Body minmax;
19538 StyleFitContent_Body fit_content;
19539 };
19540
19541 static StyleGenericTrackSize Breadth(const StyleGenericTrackBreadth<L> &_0) {
19542 StyleGenericTrackSize result;
19543 ::new (&result.breadth._0) (StyleGenericTrackBreadth<L>)(_0);
19544 result.tag = Tag::Breadth;
19545 return result;
19546 }
19547
19548 bool IsBreadth() const {
19549 return tag == Tag::Breadth;
19550 }
19551
19552 const StyleGenericTrackBreadth<L>& AsBreadth() const {
19553 MOZ_DIAGNOSTIC_ASSERT(IsBreadth())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsBreadth())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsBreadth()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsBreadth()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19553); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsBreadth()"
")"); do { *((volatile int*)__null) = 19553; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19554 return breadth._0;
19555 }
19556
19557 static StyleGenericTrackSize Minmax(const StyleGenericTrackBreadth<L> &_0,
19558 const StyleGenericTrackBreadth<L> &_1) {
19559 StyleGenericTrackSize result;
19560 ::new (&result.minmax._0) (StyleGenericTrackBreadth<L>)(_0);
19561 ::new (&result.minmax._1) (StyleGenericTrackBreadth<L>)(_1);
19562 result.tag = Tag::Minmax;
19563 return result;
19564 }
19565
19566 bool IsMinmax() const {
19567 return tag == Tag::Minmax;
19568 }
19569
19570 const StyleMinmax_Body& AsMinmax() const {
19571 MOZ_DIAGNOSTIC_ASSERT(IsMinmax())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsMinmax())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsMinmax()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsMinmax()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19571); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsMinmax()"
")"); do { *((volatile int*)__null) = 19571; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19572 return minmax;
19573 }
19574
19575 static StyleGenericTrackSize FitContent(const StyleGenericTrackBreadth<L> &_0) {
19576 StyleGenericTrackSize result;
19577 ::new (&result.fit_content._0) (StyleGenericTrackBreadth<L>)(_0);
19578 result.tag = Tag::FitContent;
19579 return result;
19580 }
19581
19582 bool IsFitContent() const {
19583 return tag == Tag::FitContent;
19584 }
19585
19586 const StyleGenericTrackBreadth<L>& AsFitContent() const {
19587 MOZ_DIAGNOSTIC_ASSERT(IsFitContent())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsFitContent())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsFitContent()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsFitContent()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19587); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsFitContent()"
")"); do { *((volatile int*)__null) = 19587; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19588 return fit_content._0;
19589 }
19590
19591 bool operator==(const StyleGenericTrackSize& other) const {
19592 if (tag != other.tag) {
19593 return false;
19594 }
19595 switch (tag) {
19596 case Tag::Breadth: return breadth == other.breadth;
19597 case Tag::Minmax: return minmax == other.minmax;
19598 case Tag::FitContent: return fit_content == other.fit_content;
19599
19600 }
19601 return true;
19602 }
19603
19604 bool operator!=(const StyleGenericTrackSize& other) const {
19605 return !(*this == other);
19606 }
19607
19608 private:
19609 StyleGenericTrackSize() {
19610
19611 }
19612 public:
19613
19614
19615 ~StyleGenericTrackSize() {
19616 switch (tag) {
19617 case Tag::Breadth: breadth.~StyleBreadth_Body(); break;
19618 case Tag::Minmax: minmax.~StyleMinmax_Body(); break;
19619 case Tag::FitContent: fit_content.~StyleFitContent_Body(); break;
19620
19621 }
19622 }
19623
19624 StyleGenericTrackSize(const StyleGenericTrackSize& other)
19625 : tag(other.tag) {
19626 switch (tag) {
19627 case Tag::Breadth: ::new (&breadth) (StyleBreadth_Body)(other.breadth); break;
19628 case Tag::Minmax: ::new (&minmax) (StyleMinmax_Body)(other.minmax); break;
19629 case Tag::FitContent: ::new (&fit_content) (StyleFitContent_Body)(other.fit_content); break;
19630
19631 }
19632 }
19633 StyleGenericTrackSize& operator=(const StyleGenericTrackSize& other) {
19634 if (this != &other) {
19635 this->~StyleGenericTrackSize();
19636 new (this) StyleGenericTrackSize(other);
19637 }
19638 return *this;
19639 }
19640 // Implemented in nsGridContainerFrame.cpp
19641 inline const StyleGenericTrackBreadth<L>& GetMin() const;
19642 inline const StyleGenericTrackBreadth<L>& GetMax() const;
19643};
19644
19645/// The computed value of a grid `<track-size>`
19646using StyleTrackSize = StyleGenericTrackSize<StyleLengthPercentage>;
19647
19648/// The computed value of a grid `<track-breadth>`
19649using StyleTrackBreadth = StyleGenericTrackBreadth<StyleLengthPercentage>;
19650
19651/// A `<track-size>+`.
19652/// We use the empty slice as `auto`, and always parse `auto` as an empty slice.
19653/// This means it's impossible to have a slice containing only one auto item.
19654template<typename T>
19655using StyleGenericImplicitGridTracks = StyleOwnedSlice<T>;
19656
19657/// The computed value of a grid `<track-size>+`
19658using StyleImplicitGridTracks = StyleGenericImplicitGridTracks<StyleTrackSize>;
19659
19660/// An SVG paint value without the fallback.
19661///
19662/// Whereas the spec only allows PaintServer to have a fallback, Gecko lets the
19663/// context properties have a fallback as well.
19664template<typename C, typename U>
19665struct StyleGenericSVGPaintKind {
19666 enum class Tag : uint8_t {
19667 /// `none`
19668 None,
19669 /// `<color>`
19670 Color,
19671 /// `url(...)`
19672 PaintServer,
19673 /// `context-fill`
19674 ContextFill,
19675 /// `context-stroke`
19676 ContextStroke,
19677 };
19678
19679 struct StyleColor_Body {
19680 C _0;
19681
19682 bool operator==(const StyleColor_Body& other) const {
19683 return _0 == other._0;
19684 }
19685 bool operator!=(const StyleColor_Body& other) const {
19686 return _0 != other._0;
19687 }
19688 };
19689
19690 struct StylePaintServer_Body {
19691 U _0;
19692
19693 bool operator==(const StylePaintServer_Body& other) const {
19694 return _0 == other._0;
19695 }
19696 bool operator!=(const StylePaintServer_Body& other) const {
19697 return _0 != other._0;
19698 }
19699 };
19700
19701 Tag tag;
19702 union {
19703 StyleColor_Body color;
19704 StylePaintServer_Body paint_server;
19705 };
19706
19707 static StyleGenericSVGPaintKind None() {
19708 StyleGenericSVGPaintKind result;
19709 result.tag = Tag::None;
19710 return result;
19711 }
19712
19713 bool IsNone() const {
19714 return tag == Tag::None;
19715 }
19716
19717 static StyleGenericSVGPaintKind Color(const C &_0) {
19718 StyleGenericSVGPaintKind result;
19719 ::new (&result.color._0) (C)(_0);
19720 result.tag = Tag::Color;
19721 return result;
19722 }
19723
19724 bool IsColor() const {
19725 return tag == Tag::Color;
19726 }
19727
19728 const C& AsColor() const {
19729 MOZ_DIAGNOSTIC_ASSERT(IsColor())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsColor())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsColor()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsColor()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19729); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsColor()"
")"); do { *((volatile int*)__null) = 19729; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19730 return color._0;
19731 }
19732
19733 static StyleGenericSVGPaintKind PaintServer(const U &_0) {
19734 StyleGenericSVGPaintKind result;
19735 ::new (&result.paint_server._0) (U)(_0);
19736 result.tag = Tag::PaintServer;
19737 return result;
19738 }
19739
19740 bool IsPaintServer() const {
19741 return tag == Tag::PaintServer;
19742 }
19743
19744 const U& AsPaintServer() const {
19745 MOZ_DIAGNOSTIC_ASSERT(IsPaintServer())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPaintServer())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPaintServer()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPaintServer()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19745); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPaintServer()"
")"); do { *((volatile int*)__null) = 19745; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19746 return paint_server._0;
19747 }
19748
19749 static StyleGenericSVGPaintKind ContextFill() {
19750 StyleGenericSVGPaintKind result;
19751 result.tag = Tag::ContextFill;
19752 return result;
19753 }
19754
19755 bool IsContextFill() const {
19756 return tag == Tag::ContextFill;
19757 }
19758
19759 static StyleGenericSVGPaintKind ContextStroke() {
19760 StyleGenericSVGPaintKind result;
19761 result.tag = Tag::ContextStroke;
19762 return result;
19763 }
19764
19765 bool IsContextStroke() const {
19766 return tag == Tag::ContextStroke;
19767 }
19768
19769 bool operator==(const StyleGenericSVGPaintKind& other) const {
19770 if (tag != other.tag) {
19771 return false;
19772 }
19773 switch (tag) {
19774 case Tag::Color: return color == other.color;
19775 case Tag::PaintServer: return paint_server == other.paint_server;
19776 default: break;
19777 }
19778 return true;
19779 }
19780
19781 bool operator!=(const StyleGenericSVGPaintKind& other) const {
19782 return !(*this == other);
19783 }
19784
19785 private:
19786 StyleGenericSVGPaintKind() {
19787
19788 }
19789 public:
19790
19791
19792 ~StyleGenericSVGPaintKind() {
19793 switch (tag) {
19794 case Tag::Color: color.~StyleColor_Body(); break;
19795 case Tag::PaintServer: paint_server.~StylePaintServer_Body(); break;
19796 default: break;
19797 }
19798 }
19799
19800 StyleGenericSVGPaintKind(const StyleGenericSVGPaintKind& other)
19801 : tag(other.tag) {
19802 switch (tag) {
19803 case Tag::Color: ::new (&color) (StyleColor_Body)(other.color); break;
19804 case Tag::PaintServer: ::new (&paint_server) (StylePaintServer_Body)(other.paint_server); break;
19805 default: break;
19806 }
19807 }
19808 StyleGenericSVGPaintKind& operator=(const StyleGenericSVGPaintKind& other) {
19809 if (this != &other) {
19810 this->~StyleGenericSVGPaintKind();
19811 new (this) StyleGenericSVGPaintKind(other);
19812 }
19813 return *this;
19814 }
19815};
19816
19817/// The fallback of an SVG paint server value.
19818template<typename C>
19819struct StyleGenericSVGPaintFallback {
19820 enum class Tag : uint8_t {
19821 /// The `none` keyword.
19822 None,
19823 /// A magic value that represents no fallback specified and serializes to
19824 /// the empty string.
19825 Unset,
19826 /// A color.
19827 Color,
19828 };
19829
19830 struct StyleColor_Body {
19831 C _0;
19832
19833 bool operator==(const StyleColor_Body& other) const {
19834 return _0 == other._0;
19835 }
19836 bool operator!=(const StyleColor_Body& other) const {
19837 return _0 != other._0;
19838 }
19839 };
19840
19841 Tag tag;
19842 union {
19843 StyleColor_Body color;
19844 };
19845
19846 static StyleGenericSVGPaintFallback None() {
19847 StyleGenericSVGPaintFallback result;
19848 result.tag = Tag::None;
19849 return result;
19850 }
19851
19852 bool IsNone() const {
19853 return tag == Tag::None;
19854 }
19855
19856 static StyleGenericSVGPaintFallback Unset() {
19857 StyleGenericSVGPaintFallback result;
19858 result.tag = Tag::Unset;
19859 return result;
19860 }
19861
19862 bool IsUnset() const {
19863 return tag == Tag::Unset;
19864 }
19865
19866 static StyleGenericSVGPaintFallback Color(const C &_0) {
19867 StyleGenericSVGPaintFallback result;
19868 ::new (&result.color._0) (C)(_0);
19869 result.tag = Tag::Color;
19870 return result;
19871 }
19872
19873 bool IsColor() const {
19874 return tag == Tag::Color;
19875 }
19876
19877 const C& AsColor() const {
19878 MOZ_DIAGNOSTIC_ASSERT(IsColor())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsColor())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsColor()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsColor()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19878); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsColor()"
")"); do { *((volatile int*)__null) = 19878; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19879 return color._0;
19880 }
19881
19882 bool operator==(const StyleGenericSVGPaintFallback& other) const {
19883 if (tag != other.tag) {
19884 return false;
19885 }
19886 switch (tag) {
19887 case Tag::Color: return color == other.color;
19888 default: break;
19889 }
19890 return true;
19891 }
19892
19893 bool operator!=(const StyleGenericSVGPaintFallback& other) const {
19894 return !(*this == other);
19895 }
19896
19897 private:
19898 StyleGenericSVGPaintFallback() {
19899
19900 }
19901 public:
19902
19903
19904 ~StyleGenericSVGPaintFallback() {
19905 switch (tag) {
19906 case Tag::Color: color.~StyleColor_Body(); break;
19907 default: break;
19908 }
19909 }
19910
19911 StyleGenericSVGPaintFallback(const StyleGenericSVGPaintFallback& other)
19912 : tag(other.tag) {
19913 switch (tag) {
19914 case Tag::Color: ::new (&color) (StyleColor_Body)(other.color); break;
19915 default: break;
19916 }
19917 }
19918 StyleGenericSVGPaintFallback& operator=(const StyleGenericSVGPaintFallback& other) {
19919 if (this != &other) {
19920 this->~StyleGenericSVGPaintFallback();
19921 new (this) StyleGenericSVGPaintFallback(other);
19922 }
19923 return *this;
19924 }
19925};
19926
19927/// An SVG paint value
19928///
19929/// <https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint>
19930template<typename Color, typename Url>
19931struct StyleGenericSVGPaint {
19932 /// The paint source.
19933 StyleGenericSVGPaintKind<Color, Url> kind;
19934 /// The fallback color.
19935 StyleGenericSVGPaintFallback<Color> fallback;
19936
19937 bool operator==(const StyleGenericSVGPaint& other) const {
19938 return kind == other.kind &&
19939 fallback == other.fallback;
19940 }
19941 bool operator!=(const StyleGenericSVGPaint& other) const {
19942 return kind != other.kind ||
19943 fallback != other.fallback;
19944 }
19945};
19946
19947/// Computed SVG Paint value
19948using StyleSVGPaint = StyleGenericSVGPaint<StyleColor, StyleComputedUrl>;
19949
19950/// Computed SVG Paint Kind value
19951using StyleSVGPaintKind = StyleGenericSVGPaintKind<StyleColor, StyleComputedUrl>;
19952
19953/// The initial argument of the `repeat` function.
19954///
19955/// <https://drafts.csswg.org/css-grid/#typedef-track-repeat>
19956template<typename Integer>
19957struct StyleRepeatCount {
19958 enum class Tag : uint8_t {
19959 /// A positive integer. This is allowed only for `<track-repeat>` and `<fixed-repeat>`
19960 Number,
19961 /// An `<auto-fill>` keyword allowed only for `<auto-repeat>`
19962 AutoFill,
19963 /// An `<auto-fit>` keyword allowed only for `<auto-repeat>`
19964 AutoFit,
19965 };
19966
19967 struct StyleNumber_Body {
19968 Integer _0;
19969
19970 bool operator==(const StyleNumber_Body& other) const {
19971 return _0 == other._0;
19972 }
19973 bool operator!=(const StyleNumber_Body& other) const {
19974 return _0 != other._0;
19975 }
19976 };
19977
19978 Tag tag;
19979 union {
19980 StyleNumber_Body number;
19981 };
19982
19983 static StyleRepeatCount Number(const Integer &_0) {
19984 StyleRepeatCount result;
19985 ::new (&result.number._0) (Integer)(_0);
19986 result.tag = Tag::Number;
19987 return result;
19988 }
19989
19990 bool IsNumber() const {
19991 return tag == Tag::Number;
19992 }
19993
19994 const Integer& AsNumber() const {
19995 MOZ_DIAGNOSTIC_ASSERT(IsNumber())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsNumber())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsNumber()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsNumber()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 19995); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsNumber()"
")"); do { *((volatile int*)__null) = 19995; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
19996 return number._0;
19997 }
19998
19999 static StyleRepeatCount AutoFill() {
20000 StyleRepeatCount result;
20001 result.tag = Tag::AutoFill;
20002 return result;
20003 }
20004
20005 bool IsAutoFill() const {
20006 return tag == Tag::AutoFill;
20007 }
20008
20009 static StyleRepeatCount AutoFit() {
20010 StyleRepeatCount result;
20011 result.tag = Tag::AutoFit;
20012 return result;
20013 }
20014
20015 bool IsAutoFit() const {
20016 return tag == Tag::AutoFit;
20017 }
20018
20019 bool operator==(const StyleRepeatCount& other) const {
20020 if (tag != other.tag) {
20021 return false;
20022 }
20023 switch (tag) {
20024 case Tag::Number: return number == other.number;
20025 default: break;
20026 }
20027 return true;
20028 }
20029
20030 bool operator!=(const StyleRepeatCount& other) const {
20031 return !(*this == other);
20032 }
20033
20034 private:
20035 StyleRepeatCount() {
20036
20037 }
20038 public:
20039
20040
20041 ~StyleRepeatCount() {
20042 switch (tag) {
20043 case Tag::Number: number.~StyleNumber_Body(); break;
20044 default: break;
20045 }
20046 }
20047
20048 StyleRepeatCount(const StyleRepeatCount& other)
20049 : tag(other.tag) {
20050 switch (tag) {
20051 case Tag::Number: ::new (&number) (StyleNumber_Body)(other.number); break;
20052 default: break;
20053 }
20054 }
20055 StyleRepeatCount& operator=(const StyleRepeatCount& other) {
20056 if (this != &other) {
20057 this->~StyleRepeatCount();
20058 new (this) StyleRepeatCount(other);
20059 }
20060 return *this;
20061 }
20062};
20063
20064/// The structure containing `<line-names>` and `<track-size>` values.
20065template<typename L, typename I>
20066struct StyleGenericTrackRepeat {
20067 /// The number of times for the value to be repeated (could also be `auto-fit` or `auto-fill`)
20068 StyleRepeatCount<I> count;
20069 /// `<line-names>` accompanying `<track_size>` values.
20070 ///
20071 /// If there's no `<line-names>`, then it's represented by an empty vector.
20072 /// For N `<track-size>` values, there will be N+1 `<line-names>`, and so this vector's
20073 /// length is always one value more than that of the `<track-size>`.
20074 StyleOwnedSlice<StyleOwnedSlice<StyleCustomIdent>> line_names;
20075 /// `<track-size>` values.
20076 StyleOwnedSlice<StyleGenericTrackSize<L>> track_sizes;
20077
20078 bool operator==(const StyleGenericTrackRepeat& other) const {
20079 return count == other.count &&
20080 line_names == other.line_names &&
20081 track_sizes == other.track_sizes;
20082 }
20083 bool operator!=(const StyleGenericTrackRepeat& other) const {
20084 return count != other.count ||
20085 line_names != other.line_names ||
20086 track_sizes != other.track_sizes;
20087 }
20088};
20089
20090/// Track list values. Can be <track-size> or <track-repeat>
20091template<typename LengthPercentage, typename Integer>
20092struct StyleGenericTrackListValue {
20093 enum class Tag : uint8_t {
20094 /// A <track-size> value.
20095 TrackSize,
20096 /// A <track-repeat> value.
20097 TrackRepeat,
20098 };
20099
20100 struct StyleTrackSize_Body {
20101 StyleGenericTrackSize<LengthPercentage> _0;
20102
20103 bool operator==(const StyleTrackSize_Body& other) const {
20104 return _0 == other._0;
20105 }
20106 bool operator!=(const StyleTrackSize_Body& other) const {
20107 return _0 != other._0;
20108 }
20109 };
20110
20111 struct StyleTrackRepeat_Body {
20112 StyleGenericTrackRepeat<LengthPercentage, Integer> _0;
20113
20114 bool operator==(const StyleTrackRepeat_Body& other) const {
20115 return _0 == other._0;
20116 }
20117 bool operator!=(const StyleTrackRepeat_Body& other) const {
20118 return _0 != other._0;
20119 }
20120 };
20121
20122 Tag tag;
20123 union {
20124 StyleTrackSize_Body track_size;
20125 StyleTrackRepeat_Body track_repeat;
20126 };
20127
20128 static StyleGenericTrackListValue TrackSize(const StyleGenericTrackSize<LengthPercentage> &_0) {
20129 StyleGenericTrackListValue result;
20130 ::new (&result.track_size._0) (StyleGenericTrackSize<LengthPercentage>)(_0);
20131 result.tag = Tag::TrackSize;
20132 return result;
20133 }
20134
20135 bool IsTrackSize() const {
20136 return tag == Tag::TrackSize;
20137 }
20138
20139 const StyleGenericTrackSize<LengthPercentage>& AsTrackSize() const {
20140 MOZ_DIAGNOSTIC_ASSERT(IsTrackSize())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTrackSize())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTrackSize()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsTrackSize()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20140); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTrackSize()"
")"); do { *((volatile int*)__null) = 20140; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20141 return track_size._0;
20142 }
20143
20144 static StyleGenericTrackListValue TrackRepeat(const StyleGenericTrackRepeat<LengthPercentage, Integer> &_0) {
20145 StyleGenericTrackListValue result;
20146 ::new (&result.track_repeat._0) (StyleGenericTrackRepeat<LengthPercentage, Integer>)(_0);
20147 result.tag = Tag::TrackRepeat;
20148 return result;
20149 }
20150
20151 bool IsTrackRepeat() const {
20152 return tag == Tag::TrackRepeat;
20153 }
20154
20155 const StyleGenericTrackRepeat<LengthPercentage, Integer>& AsTrackRepeat() const {
20156 MOZ_DIAGNOSTIC_ASSERT(IsTrackRepeat())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTrackRepeat())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTrackRepeat()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsTrackRepeat()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20156); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTrackRepeat()"
")"); do { *((volatile int*)__null) = 20156; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20157 return track_repeat._0;
20158 }
20159
20160 bool operator==(const StyleGenericTrackListValue& other) const {
20161 if (tag != other.tag) {
20162 return false;
20163 }
20164 switch (tag) {
20165 case Tag::TrackSize: return track_size == other.track_size;
20166 case Tag::TrackRepeat: return track_repeat == other.track_repeat;
20167
20168 }
20169 return true;
20170 }
20171
20172 bool operator!=(const StyleGenericTrackListValue& other) const {
20173 return !(*this == other);
20174 }
20175
20176 private:
20177 StyleGenericTrackListValue() {
20178
20179 }
20180 public:
20181
20182
20183 ~StyleGenericTrackListValue() {
20184 switch (tag) {
20185 case Tag::TrackSize: track_size.~StyleTrackSize_Body(); break;
20186 case Tag::TrackRepeat: track_repeat.~StyleTrackRepeat_Body(); break;
20187
20188 }
20189 }
20190
20191 StyleGenericTrackListValue(const StyleGenericTrackListValue& other)
20192 : tag(other.tag) {
20193 switch (tag) {
20194 case Tag::TrackSize: ::new (&track_size) (StyleTrackSize_Body)(other.track_size); break;
20195 case Tag::TrackRepeat: ::new (&track_repeat) (StyleTrackRepeat_Body)(other.track_repeat); break;
20196
20197 }
20198 }
20199 StyleGenericTrackListValue& operator=(const StyleGenericTrackListValue& other) {
20200 if (this != &other) {
20201 this->~StyleGenericTrackListValue();
20202 new (this) StyleGenericTrackListValue(other);
20203 }
20204 return *this;
20205 }
20206};
20207
20208/// A grid `<track-list>` type.
20209///
20210/// <https://drafts.csswg.org/css-grid/#typedef-track-list>
20211template<typename LengthPercentage, typename Integer>
20212struct StyleGenericTrackList {
20213 /// The index in `values` where our `<auto-repeat>` value is, if in bounds.
20214 uintptr_t auto_repeat_index;
20215 /// A vector of `<track-size> | <track-repeat>` values.
20216 StyleOwnedSlice<StyleGenericTrackListValue<LengthPercentage, Integer>> values;
20217 /// `<line-names>` accompanying `<track-size> | <track-repeat>` values.
20218 ///
20219 /// If there's no `<line-names>`, then it's represented by an empty vector.
20220 /// For N values, there will be N+1 `<line-names>`, and so this vector's
20221 /// length is always one value more than that of the `<track-size>`.
20222 StyleOwnedSlice<StyleOwnedSlice<StyleCustomIdent>> line_names;
20223
20224 bool operator==(const StyleGenericTrackList& other) const {
20225 return auto_repeat_index == other.auto_repeat_index &&
20226 values == other.values &&
20227 line_names == other.line_names;
20228 }
20229 bool operator!=(const StyleGenericTrackList& other) const {
20230 return auto_repeat_index != other.auto_repeat_index ||
20231 values != other.values ||
20232 line_names != other.line_names;
20233 }
20234};
20235
20236/// The `<name-repeat>` for subgrids.
20237///
20238/// <name-repeat> = repeat( [ <integer [1,∞]> | auto-fill ], <line-names>+)
20239///
20240/// https://drafts.csswg.org/css-grid/#typedef-name-repeat
20241template<typename I>
20242struct StyleGenericNameRepeat {
20243 /// The number of times for the value to be repeated (could also be `auto-fill`).
20244 /// Note: `RepeatCount` accepts `auto-fit`, so we should reject it after parsing it.
20245 StyleRepeatCount<I> count;
20246 /// This represents `<line-names>+`. The length of the outer vector is at least one.
20247 StyleOwnedSlice<StyleOwnedSlice<StyleCustomIdent>> line_names;
20248
20249 bool operator==(const StyleGenericNameRepeat& other) const {
20250 return count == other.count &&
20251 line_names == other.line_names;
20252 }
20253 bool operator!=(const StyleGenericNameRepeat& other) const {
20254 return count != other.count ||
20255 line_names != other.line_names;
20256 }
20257};
20258
20259/// A single value for `<line-names>` or `<name-repeat>`.
20260template<typename I>
20261struct StyleGenericLineNameListValue {
20262 enum class Tag : uint8_t {
20263 /// `<line-names>`.
20264 LineNames,
20265 /// `<name-repeat>`.
20266 Repeat,
20267 };
20268
20269 struct StyleLineNames_Body {
20270 StyleOwnedSlice<StyleCustomIdent> _0;
20271
20272 bool operator==(const StyleLineNames_Body& other) const {
20273 return _0 == other._0;
20274 }
20275 bool operator!=(const StyleLineNames_Body& other) const {
20276 return _0 != other._0;
20277 }
20278 };
20279
20280 struct StyleRepeat_Body {
20281 StyleGenericNameRepeat<I> _0;
20282
20283 bool operator==(const StyleRepeat_Body& other) const {
20284 return _0 == other._0;
20285 }
20286 bool operator!=(const StyleRepeat_Body& other) const {
20287 return _0 != other._0;
20288 }
20289 };
20290
20291 Tag tag;
20292 union {
20293 StyleLineNames_Body line_names;
20294 StyleRepeat_Body repeat;
20295 };
20296
20297 static StyleGenericLineNameListValue LineNames(const StyleOwnedSlice<StyleCustomIdent> &_0) {
20298 StyleGenericLineNameListValue result;
20299 ::new (&result.line_names._0) (StyleOwnedSlice<StyleCustomIdent>)(_0);
20300 result.tag = Tag::LineNames;
20301 return result;
20302 }
20303
20304 bool IsLineNames() const {
20305 return tag == Tag::LineNames;
20306 }
20307
20308 const StyleOwnedSlice<StyleCustomIdent>& AsLineNames() const {
20309 MOZ_DIAGNOSTIC_ASSERT(IsLineNames())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLineNames())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLineNames()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsLineNames()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20309); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLineNames()"
")"); do { *((volatile int*)__null) = 20309; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20310 return line_names._0;
20311 }
20312
20313 static StyleGenericLineNameListValue Repeat(const StyleGenericNameRepeat<I> &_0) {
20314 StyleGenericLineNameListValue result;
20315 ::new (&result.repeat._0) (StyleGenericNameRepeat<I>)(_0);
20316 result.tag = Tag::Repeat;
20317 return result;
20318 }
20319
20320 bool IsRepeat() const {
20321 return tag == Tag::Repeat;
20322 }
20323
20324 const StyleGenericNameRepeat<I>& AsRepeat() const {
20325 MOZ_DIAGNOSTIC_ASSERT(IsRepeat())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRepeat())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRepeat()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsRepeat()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20325); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRepeat()"
")"); do { *((volatile int*)__null) = 20325; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20326 return repeat._0;
20327 }
20328
20329 bool operator==(const StyleGenericLineNameListValue& other) const {
20330 if (tag != other.tag) {
20331 return false;
20332 }
20333 switch (tag) {
20334 case Tag::LineNames: return line_names == other.line_names;
20335 case Tag::Repeat: return repeat == other.repeat;
20336
20337 }
20338 return true;
20339 }
20340
20341 bool operator!=(const StyleGenericLineNameListValue& other) const {
20342 return !(*this == other);
20343 }
20344
20345 private:
20346 StyleGenericLineNameListValue() {
20347
20348 }
20349 public:
20350
20351
20352 ~StyleGenericLineNameListValue() {
20353 switch (tag) {
20354 case Tag::LineNames: line_names.~StyleLineNames_Body(); break;
20355 case Tag::Repeat: repeat.~StyleRepeat_Body(); break;
20356
20357 }
20358 }
20359
20360 StyleGenericLineNameListValue(const StyleGenericLineNameListValue& other)
20361 : tag(other.tag) {
20362 switch (tag) {
20363 case Tag::LineNames: ::new (&line_names) (StyleLineNames_Body)(other.line_names); break;
20364 case Tag::Repeat: ::new (&repeat) (StyleRepeat_Body)(other.repeat); break;
20365
20366 }
20367 }
20368 StyleGenericLineNameListValue& operator=(const StyleGenericLineNameListValue& other) {
20369 if (this != &other) {
20370 this->~StyleGenericLineNameListValue();
20371 new (this) StyleGenericLineNameListValue(other);
20372 }
20373 return *this;
20374 }
20375};
20376
20377/// The `<line-name-list>` for subgrids.
20378///
20379/// <line-name-list> = [ <line-names> | <name-repeat> ]+
20380/// <name-repeat> = repeat( [ <integer [1,∞]> | auto-fill ], <line-names>+)
20381///
20382/// https://drafts.csswg.org/css-grid/#typedef-line-name-list
20383template<typename I>
20384struct StyleGenericLineNameList {
20385 /// The pre-computed length of line_names, without the length of repeat(auto-fill, ...).
20386 uintptr_t expanded_line_names_length;
20387 /// The line name list.
20388 StyleOwnedSlice<StyleGenericLineNameListValue<I>> line_names;
20389
20390 bool operator==(const StyleGenericLineNameList& other) const {
20391 return expanded_line_names_length == other.expanded_line_names_length &&
20392 line_names == other.line_names;
20393 }
20394 bool operator!=(const StyleGenericLineNameList& other) const {
20395 return expanded_line_names_length != other.expanded_line_names_length ||
20396 line_names != other.line_names;
20397 }
20398};
20399
20400/// Variants for `<grid-template-rows> | <grid-template-columns>`
20401template<typename L, typename I>
20402struct StyleGenericGridTemplateComponent {
20403 enum class Tag : uint8_t {
20404 /// `none` value.
20405 None,
20406 /// The grid `<track-list>`
20407 TrackList,
20408 /// A `subgrid <line-name-list>?`
20409 /// TODO: Support animations for this after subgrid is addressed in [grid-2] spec.
20410 Subgrid,
20411 /// `masonry` value.
20412 /// https://github.com/w3c/csswg-drafts/issues/4650
20413 Masonry,
20414 };
20415
20416 struct StyleTrackList_Body {
20417 StyleBox<StyleGenericTrackList<L, I>> _0;
20418
20419 bool operator==(const StyleTrackList_Body& other) const {
20420 return _0 == other._0;
20421 }
20422 bool operator!=(const StyleTrackList_Body& other) const {
20423 return _0 != other._0;
20424 }
20425 };
20426
20427 struct StyleSubgrid_Body {
20428 StyleBox<StyleGenericLineNameList<I>> _0;
20429
20430 bool operator==(const StyleSubgrid_Body& other) const {
20431 return _0 == other._0;
20432 }
20433 bool operator!=(const StyleSubgrid_Body& other) const {
20434 return _0 != other._0;
20435 }
20436 };
20437
20438 Tag tag;
20439 union {
20440 StyleTrackList_Body track_list;
20441 StyleSubgrid_Body subgrid;
20442 };
20443
20444 static StyleGenericGridTemplateComponent None() {
20445 StyleGenericGridTemplateComponent result;
20446 result.tag = Tag::None;
20447 return result;
20448 }
20449
20450 bool IsNone() const {
20451 return tag == Tag::None;
20452 }
20453
20454 static StyleGenericGridTemplateComponent TrackList(const StyleBox<StyleGenericTrackList<L, I>> &_0) {
20455 StyleGenericGridTemplateComponent result;
20456 ::new (&result.track_list._0) (StyleBox<StyleGenericTrackList<L, I>>)(_0);
20457 result.tag = Tag::TrackList;
20458 return result;
20459 }
20460
20461 bool IsTrackList() const {
20462 return tag == Tag::TrackList;
20463 }
20464
20465 const StyleBox<StyleGenericTrackList<L, I>>& AsTrackList() const {
20466 MOZ_DIAGNOSTIC_ASSERT(IsTrackList())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsTrackList())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsTrackList()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsTrackList()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20466); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsTrackList()"
")"); do { *((volatile int*)__null) = 20466; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20467 return track_list._0;
20468 }
20469
20470 static StyleGenericGridTemplateComponent Subgrid(const StyleBox<StyleGenericLineNameList<I>> &_0) {
20471 StyleGenericGridTemplateComponent result;
20472 ::new (&result.subgrid._0) (StyleBox<StyleGenericLineNameList<I>>)(_0);
20473 result.tag = Tag::Subgrid;
20474 return result;
20475 }
20476
20477 bool IsSubgrid() const {
20478 return tag == Tag::Subgrid;
20479 }
20480
20481 const StyleBox<StyleGenericLineNameList<I>>& AsSubgrid() const {
20482 MOZ_DIAGNOSTIC_ASSERT(IsSubgrid())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSubgrid())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSubgrid()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsSubgrid()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20482); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSubgrid()"
")"); do { *((volatile int*)__null) = 20482; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20483 return subgrid._0;
20484 }
20485
20486 static StyleGenericGridTemplateComponent Masonry() {
20487 StyleGenericGridTemplateComponent result;
20488 result.tag = Tag::Masonry;
20489 return result;
20490 }
20491
20492 bool IsMasonry() const {
20493 return tag == Tag::Masonry;
20494 }
20495
20496 bool operator==(const StyleGenericGridTemplateComponent& other) const {
20497 if (tag != other.tag) {
20498 return false;
20499 }
20500 switch (tag) {
20501 case Tag::TrackList: return track_list == other.track_list;
20502 case Tag::Subgrid: return subgrid == other.subgrid;
20503 default: break;
20504 }
20505 return true;
20506 }
20507
20508 bool operator!=(const StyleGenericGridTemplateComponent& other) const {
20509 return !(*this == other);
20510 }
20511
20512 private:
20513 StyleGenericGridTemplateComponent() {
20514
20515 }
20516 public:
20517
20518
20519 ~StyleGenericGridTemplateComponent() {
20520 switch (tag) {
20521 case Tag::TrackList: track_list.~StyleTrackList_Body(); break;
20522 case Tag::Subgrid: subgrid.~StyleSubgrid_Body(); break;
20523 default: break;
20524 }
20525 }
20526
20527 StyleGenericGridTemplateComponent(const StyleGenericGridTemplateComponent& other)
20528 : tag(other.tag) {
20529 switch (tag) {
20530 case Tag::TrackList: ::new (&track_list) (StyleTrackList_Body)(other.track_list); break;
20531 case Tag::Subgrid: ::new (&subgrid) (StyleSubgrid_Body)(other.subgrid); break;
20532 default: break;
20533 }
20534 }
20535 StyleGenericGridTemplateComponent& operator=(const StyleGenericGridTemplateComponent& other) {
20536 if (this != &other) {
20537 this->~StyleGenericGridTemplateComponent();
20538 new (this) StyleGenericGridTemplateComponent(other);
20539 }
20540 return *this;
20541 }
20542 inline Maybe<size_t> RepeatAutoIndex() const;
20543 inline const StyleGenericTrackRepeat<L, I>* GetRepeatAutoValue() const;
20544 inline bool HasRepeatAuto() const;
20545 inline Span<const StyleOwnedSlice<StyleCustomIdent>> LineNameLists(bool aIsSubgrid) const;
20546 inline Span<const StyleGenericTrackListValue<L, I>> TrackListValues() const;
20547};
20548
20549/// `<grid-template-rows> | <grid-template-columns>`
20550using StyleGridTemplateComponent = StyleGenericGridTemplateComponent<StyleLengthPercentage, StyleInteger>;
20551
20552/// Computed value for the text-emphasis-style property
20553struct StyleTextEmphasisStyle {
20554 enum class Tag : uint8_t {
20555 /// [ <fill> || <shape> ]
20556 Keyword,
20557 /// `none`
20558 None,
20559 /// `<string>` (of which only the first grapheme cluster will be used).
20560 String,
20561 };
20562
20563 struct StyleKeyword_Body {
20564 StyleTextEmphasisFillMode fill;
20565 StyleTextEmphasisShapeKeyword shape;
20566
20567 bool operator==(const StyleKeyword_Body& other) const {
20568 return fill == other.fill &&
20569 shape == other.shape;
20570 }
20571 bool operator!=(const StyleKeyword_Body& other) const {
20572 return fill != other.fill ||
20573 shape != other.shape;
20574 }
20575 };
20576
20577 struct StyleString_Body {
20578 StyleOwnedStr _0;
20579
20580 bool operator==(const StyleString_Body& other) const {
20581 return _0 == other._0;
20582 }
20583 bool operator!=(const StyleString_Body& other) const {
20584 return _0 != other._0;
20585 }
20586 };
20587
20588 Tag tag;
20589 union {
20590 StyleKeyword_Body keyword;
20591 StyleString_Body string;
20592 };
20593
20594 static StyleTextEmphasisStyle Keyword(const StyleTextEmphasisFillMode &fill,
20595 const StyleTextEmphasisShapeKeyword &shape) {
20596 StyleTextEmphasisStyle result;
20597 ::new (&result.keyword.fill) (StyleTextEmphasisFillMode)(fill);
20598 ::new (&result.keyword.shape) (StyleTextEmphasisShapeKeyword)(shape);
20599 result.tag = Tag::Keyword;
20600 return result;
20601 }
20602
20603 bool IsKeyword() const {
20604 return tag == Tag::Keyword;
20605 }
20606
20607 const StyleKeyword_Body& AsKeyword() const {
20608 MOZ_DIAGNOSTIC_ASSERT(IsKeyword())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsKeyword())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsKeyword()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsKeyword()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20608); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsKeyword()"
")"); do { *((volatile int*)__null) = 20608; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20609 return keyword;
20610 }
20611
20612 static StyleTextEmphasisStyle None() {
20613 StyleTextEmphasisStyle result;
20614 result.tag = Tag::None;
20615 return result;
20616 }
20617
20618 bool IsNone() const {
20619 return tag == Tag::None;
20620 }
20621
20622 static StyleTextEmphasisStyle String(const StyleOwnedStr &_0) {
20623 StyleTextEmphasisStyle result;
20624 ::new (&result.string._0) (StyleOwnedStr)(_0);
20625 result.tag = Tag::String;
20626 return result;
20627 }
20628
20629 bool IsString() const {
20630 return tag == Tag::String;
20631 }
20632
20633 const StyleOwnedStr& AsString() const {
20634 MOZ_DIAGNOSTIC_ASSERT(IsString())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsString())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsString()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsString()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20634); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsString()"
")"); do { *((volatile int*)__null) = 20634; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20635 return string._0;
20636 }
20637
20638 bool operator==(const StyleTextEmphasisStyle& other) const {
20639 if (tag != other.tag) {
20640 return false;
20641 }
20642 switch (tag) {
20643 case Tag::Keyword: return keyword == other.keyword;
20644 case Tag::String: return string == other.string;
20645 default: break;
20646 }
20647 return true;
20648 }
20649
20650 bool operator!=(const StyleTextEmphasisStyle& other) const {
20651 return !(*this == other);
20652 }
20653
20654 private:
20655 StyleTextEmphasisStyle() {
20656
20657 }
20658 public:
20659
20660
20661 ~StyleTextEmphasisStyle() {
20662 switch (tag) {
20663 case Tag::Keyword: keyword.~StyleKeyword_Body(); break;
20664 case Tag::String: string.~StyleString_Body(); break;
20665 default: break;
20666 }
20667 }
20668
20669 StyleTextEmphasisStyle(const StyleTextEmphasisStyle& other)
20670 : tag(other.tag) {
20671 switch (tag) {
20672 case Tag::Keyword: ::new (&keyword) (StyleKeyword_Body)(other.keyword); break;
20673 case Tag::String: ::new (&string) (StyleString_Body)(other.string); break;
20674 default: break;
20675 }
20676 }
20677 StyleTextEmphasisStyle& operator=(const StyleTextEmphasisStyle& other) {
20678 if (this != &other) {
20679 this->~StyleTextEmphasisStyle();
20680 new (this) StyleTextEmphasisStyle(other);
20681 }
20682 return *this;
20683 }
20684};
20685
20686/// Values for text-emphasis-position:
20687/// <https://drafts.csswg.org/css-text-decor/#text-emphasis-position-property>
20688struct StyleTextEmphasisPosition {
20689 uint8_t _0;
20690
20691 constexpr explicit operator bool() const {
20692 return !!_0;
20693 }
20694 constexpr StyleTextEmphasisPosition operator~() const {
20695 return StyleTextEmphasisPosition { static_cast<decltype(_0)>(~_0) };
20696 }
20697 constexpr StyleTextEmphasisPosition operator|(const StyleTextEmphasisPosition& other) const {
20698 return StyleTextEmphasisPosition { static_cast<decltype(_0)>(this->_0 | other._0) };
20699 }
20700 StyleTextEmphasisPosition& operator|=(const StyleTextEmphasisPosition& other) {
20701 *this = (*this | other);
20702 return *this;
20703 }
20704 constexpr StyleTextEmphasisPosition operator&(const StyleTextEmphasisPosition& other) const {
20705 return StyleTextEmphasisPosition { static_cast<decltype(_0)>(this->_0 & other._0) };
20706 }
20707 StyleTextEmphasisPosition& operator&=(const StyleTextEmphasisPosition& other) {
20708 *this = (*this & other);
20709 return *this;
20710 }
20711 constexpr StyleTextEmphasisPosition operator^(const StyleTextEmphasisPosition& other) const {
20712 return StyleTextEmphasisPosition { static_cast<decltype(_0)>(this->_0 ^ other._0) };
20713 }
20714 StyleTextEmphasisPosition& operator^=(const StyleTextEmphasisPosition& other) {
20715 *this = (*this ^ other);
20716 return *this;
20717 }
20718 bool operator==(const StyleTextEmphasisPosition& other) const {
20719 return _0 == other._0;
20720 }
20721 bool operator!=(const StyleTextEmphasisPosition& other) const {
20722 return _0 != other._0;
20723 }
20724 static const StyleTextEmphasisPosition AUTO;
20725 static const StyleTextEmphasisPosition OVER;
20726 static const StyleTextEmphasisPosition UNDER;
20727 static const StyleTextEmphasisPosition LEFT;
20728 static const StyleTextEmphasisPosition RIGHT;
20729};
20730/// Automatically choose mark position based on language.
20731constexpr inline const StyleTextEmphasisPosition StyleTextEmphasisPosition::AUTO = StyleTextEmphasisPosition{ /* ._0 = */ (uint8_t)(1 << 0) };
20732/// Draw marks over the text in horizontal writing mode.
20733constexpr inline const StyleTextEmphasisPosition StyleTextEmphasisPosition::OVER = StyleTextEmphasisPosition{ /* ._0 = */ (uint8_t)(1 << 1) };
20734/// Draw marks under the text in horizontal writing mode.
20735constexpr inline const StyleTextEmphasisPosition StyleTextEmphasisPosition::UNDER = StyleTextEmphasisPosition{ /* ._0 = */ (uint8_t)(1 << 2) };
20736/// Draw marks to the left of the text in vertical writing mode.
20737constexpr inline const StyleTextEmphasisPosition StyleTextEmphasisPosition::LEFT = StyleTextEmphasisPosition{ /* ._0 = */ (uint8_t)(1 << 3) };
20738/// Draw marks to the right of the text in vertical writing mode.
20739constexpr inline const StyleTextEmphasisPosition StyleTextEmphasisPosition::RIGHT = StyleTextEmphasisPosition{ /* ._0 = */ (uint8_t)(1 << 4) };
20740
20741/// Set of variant alternates
20742struct StyleVariantAlternates {
20743 enum class Tag : uint8_t {
20744 /// Enables display of stylistic alternates
20745 Stylistic,
20746 /// Enables display with stylistic sets
20747 Styleset,
20748 /// Enables display of specific character variants
20749 CharacterVariant,
20750 /// Enables display of swash glyphs
20751 Swash,
20752 /// Enables replacement of default glyphs with ornaments
20753 Ornaments,
20754 /// Enables display of alternate annotation forms
20755 Annotation,
20756 /// Enables display of historical forms
20757 HistoricalForms,
20758 };
20759
20760 struct StyleStylistic_Body {
20761 StyleCustomIdent _0;
20762
20763 bool operator==(const StyleStylistic_Body& other) const {
20764 return _0 == other._0;
20765 }
20766 bool operator!=(const StyleStylistic_Body& other) const {
20767 return _0 != other._0;
20768 }
20769 };
20770
20771 struct StyleStyleset_Body {
20772 StyleOwnedSlice<StyleCustomIdent> _0;
20773
20774 bool operator==(const StyleStyleset_Body& other) const {
20775 return _0 == other._0;
20776 }
20777 bool operator!=(const StyleStyleset_Body& other) const {
20778 return _0 != other._0;
20779 }
20780 };
20781
20782 struct StyleCharacterVariant_Body {
20783 StyleOwnedSlice<StyleCustomIdent> _0;
20784
20785 bool operator==(const StyleCharacterVariant_Body& other) const {
20786 return _0 == other._0;
20787 }
20788 bool operator!=(const StyleCharacterVariant_Body& other) const {
20789 return _0 != other._0;
20790 }
20791 };
20792
20793 struct StyleSwash_Body {
20794 StyleCustomIdent _0;
20795
20796 bool operator==(const StyleSwash_Body& other) const {
20797 return _0 == other._0;
20798 }
20799 bool operator!=(const StyleSwash_Body& other) const {
20800 return _0 != other._0;
20801 }
20802 };
20803
20804 struct StyleOrnaments_Body {
20805 StyleCustomIdent _0;
20806
20807 bool operator==(const StyleOrnaments_Body& other) const {
20808 return _0 == other._0;
20809 }
20810 bool operator!=(const StyleOrnaments_Body& other) const {
20811 return _0 != other._0;
20812 }
20813 };
20814
20815 struct StyleAnnotation_Body {
20816 StyleCustomIdent _0;
20817
20818 bool operator==(const StyleAnnotation_Body& other) const {
20819 return _0 == other._0;
20820 }
20821 bool operator!=(const StyleAnnotation_Body& other) const {
20822 return _0 != other._0;
20823 }
20824 };
20825
20826 Tag tag;
20827 union {
20828 StyleStylistic_Body stylistic;
20829 StyleStyleset_Body styleset;
20830 StyleCharacterVariant_Body character_variant;
20831 StyleSwash_Body swash;
20832 StyleOrnaments_Body ornaments;
20833 StyleAnnotation_Body annotation;
20834 };
20835
20836 static StyleVariantAlternates Stylistic(const StyleCustomIdent &_0) {
20837 StyleVariantAlternates result;
20838 ::new (&result.stylistic._0) (StyleCustomIdent)(_0);
20839 result.tag = Tag::Stylistic;
20840 return result;
20841 }
20842
20843 bool IsStylistic() const {
20844 return tag == Tag::Stylistic;
20845 }
20846
20847 const StyleCustomIdent& AsStylistic() const {
20848 MOZ_DIAGNOSTIC_ASSERT(IsStylistic())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsStylistic())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsStylistic()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsStylistic()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20848); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsStylistic()"
")"); do { *((volatile int*)__null) = 20848; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20849 return stylistic._0;
20850 }
20851
20852 static StyleVariantAlternates Styleset(const StyleOwnedSlice<StyleCustomIdent> &_0) {
20853 StyleVariantAlternates result;
20854 ::new (&result.styleset._0) (StyleOwnedSlice<StyleCustomIdent>)(_0);
20855 result.tag = Tag::Styleset;
20856 return result;
20857 }
20858
20859 bool IsStyleset() const {
20860 return tag == Tag::Styleset;
20861 }
20862
20863 const StyleOwnedSlice<StyleCustomIdent>& AsStyleset() const {
20864 MOZ_DIAGNOSTIC_ASSERT(IsStyleset())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsStyleset())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsStyleset()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsStyleset()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20864); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsStyleset()"
")"); do { *((volatile int*)__null) = 20864; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20865 return styleset._0;
20866 }
20867
20868 static StyleVariantAlternates CharacterVariant(const StyleOwnedSlice<StyleCustomIdent> &_0) {
20869 StyleVariantAlternates result;
20870 ::new (&result.character_variant._0) (StyleOwnedSlice<StyleCustomIdent>)(_0);
20871 result.tag = Tag::CharacterVariant;
20872 return result;
20873 }
20874
20875 bool IsCharacterVariant() const {
20876 return tag == Tag::CharacterVariant;
20877 }
20878
20879 const StyleOwnedSlice<StyleCustomIdent>& AsCharacterVariant() const {
20880 MOZ_DIAGNOSTIC_ASSERT(IsCharacterVariant())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCharacterVariant())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCharacterVariant()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsCharacterVariant()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20880); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCharacterVariant()"
")"); do { *((volatile int*)__null) = 20880; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20881 return character_variant._0;
20882 }
20883
20884 static StyleVariantAlternates Swash(const StyleCustomIdent &_0) {
20885 StyleVariantAlternates result;
20886 ::new (&result.swash._0) (StyleCustomIdent)(_0);
20887 result.tag = Tag::Swash;
20888 return result;
20889 }
20890
20891 bool IsSwash() const {
20892 return tag == Tag::Swash;
20893 }
20894
20895 const StyleCustomIdent& AsSwash() const {
20896 MOZ_DIAGNOSTIC_ASSERT(IsSwash())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSwash())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSwash()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSwash()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20896); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSwash()"
")"); do { *((volatile int*)__null) = 20896; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20897 return swash._0;
20898 }
20899
20900 static StyleVariantAlternates Ornaments(const StyleCustomIdent &_0) {
20901 StyleVariantAlternates result;
20902 ::new (&result.ornaments._0) (StyleCustomIdent)(_0);
20903 result.tag = Tag::Ornaments;
20904 return result;
20905 }
20906
20907 bool IsOrnaments() const {
20908 return tag == Tag::Ornaments;
20909 }
20910
20911 const StyleCustomIdent& AsOrnaments() const {
20912 MOZ_DIAGNOSTIC_ASSERT(IsOrnaments())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsOrnaments())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsOrnaments()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsOrnaments()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20912); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsOrnaments()"
")"); do { *((volatile int*)__null) = 20912; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20913 return ornaments._0;
20914 }
20915
20916 static StyleVariantAlternates Annotation(const StyleCustomIdent &_0) {
20917 StyleVariantAlternates result;
20918 ::new (&result.annotation._0) (StyleCustomIdent)(_0);
20919 result.tag = Tag::Annotation;
20920 return result;
20921 }
20922
20923 bool IsAnnotation() const {
20924 return tag == Tag::Annotation;
20925 }
20926
20927 const StyleCustomIdent& AsAnnotation() const {
20928 MOZ_DIAGNOSTIC_ASSERT(IsAnnotation())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAnnotation())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAnnotation()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsAnnotation()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 20928); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAnnotation()"
")"); do { *((volatile int*)__null) = 20928; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
20929 return annotation._0;
20930 }
20931
20932 static StyleVariantAlternates HistoricalForms() {
20933 StyleVariantAlternates result;
20934 result.tag = Tag::HistoricalForms;
20935 return result;
20936 }
20937
20938 bool IsHistoricalForms() const {
20939 return tag == Tag::HistoricalForms;
20940 }
20941
20942 bool operator==(const StyleVariantAlternates& other) const {
20943 if (tag != other.tag) {
20944 return false;
20945 }
20946 switch (tag) {
20947 case Tag::Stylistic: return stylistic == other.stylistic;
20948 case Tag::Styleset: return styleset == other.styleset;
20949 case Tag::CharacterVariant: return character_variant == other.character_variant;
20950 case Tag::Swash: return swash == other.swash;
20951 case Tag::Ornaments: return ornaments == other.ornaments;
20952 case Tag::Annotation: return annotation == other.annotation;
20953 default: break;
20954 }
20955 return true;
20956 }
20957
20958 bool operator!=(const StyleVariantAlternates& other) const {
20959 return !(*this == other);
20960 }
20961
20962 private:
20963 StyleVariantAlternates() {
20964
20965 }
20966 public:
20967
20968
20969 ~StyleVariantAlternates() {
20970 switch (tag) {
20971 case Tag::Stylistic: stylistic.~StyleStylistic_Body(); break;
20972 case Tag::Styleset: styleset.~StyleStyleset_Body(); break;
20973 case Tag::CharacterVariant: character_variant.~StyleCharacterVariant_Body(); break;
20974 case Tag::Swash: swash.~StyleSwash_Body(); break;
20975 case Tag::Ornaments: ornaments.~StyleOrnaments_Body(); break;
20976 case Tag::Annotation: annotation.~StyleAnnotation_Body(); break;
20977 default: break;
20978 }
20979 }
20980
20981 StyleVariantAlternates(const StyleVariantAlternates& other)
20982 : tag(other.tag) {
20983 switch (tag) {
20984 case Tag::Stylistic: ::new (&stylistic) (StyleStylistic_Body)(other.stylistic); break;
20985 case Tag::Styleset: ::new (&styleset) (StyleStyleset_Body)(other.styleset); break;
20986 case Tag::CharacterVariant: ::new (&character_variant) (StyleCharacterVariant_Body)(other.character_variant); break;
20987 case Tag::Swash: ::new (&swash) (StyleSwash_Body)(other.swash); break;
20988 case Tag::Ornaments: ::new (&ornaments) (StyleOrnaments_Body)(other.ornaments); break;
20989 case Tag::Annotation: ::new (&annotation) (StyleAnnotation_Body)(other.annotation); break;
20990 default: break;
20991 }
20992 }
20993 StyleVariantAlternates& operator=(const StyleVariantAlternates& other) {
20994 if (this != &other) {
20995 this->~StyleVariantAlternates();
20996 new (this) StyleVariantAlternates(other);
20997 }
20998 return *this;
20999 }
21000};
21001
21002/// List of Variant Alternates
21003using StyleFontVariantAlternates = StyleOwnedSlice<StyleVariantAlternates>;
21004
21005/// The specified value is tree `PaintOrder` values packed into the
21006/// bitfields below, as a six-bit field, of 3 two-bit pairs
21007///
21008/// Each pair can be set to FILL, STROKE, or MARKERS
21009/// Lowest significant bit pairs are highest priority.
21010/// `normal` is the empty bitfield. The three pairs are
21011/// never zero in any case other than `normal`.
21012///
21013/// Higher priority values, i.e. the values specified first,
21014/// will be painted first (and may be covered by paintings of lower priority)
21015using StyleSVGPaintOrder = uint8_t;
21016
21017/// A clip rect for clip and image-region
21018template<typename LengthOrAuto>
21019struct StyleGenericClipRect {
21020 LengthOrAuto top;
21021 LengthOrAuto right;
21022 LengthOrAuto bottom;
21023 LengthOrAuto left;
21024
21025 bool operator==(const StyleGenericClipRect& other) const {
21026 return top == other.top &&
21027 right == other.right &&
21028 bottom == other.bottom &&
21029 left == other.left;
21030 }
21031 bool operator!=(const StyleGenericClipRect& other) const {
21032 return top != other.top ||
21033 right != other.right ||
21034 bottom != other.bottom ||
21035 left != other.left;
21036 }
21037 // Get the layout rect, replacing auto right / bottom values for aAutoSize.
21038 inline nsRect ToLayoutRect(nscoord aAutoSize = NS_MAXSIZE) const;
21039};
21040
21041/// rect(...) | auto
21042using StyleClipRect = StyleGenericClipRect<StyleLengthOrAuto>;
21043
21044/// Either a clip-rect or `auto`.
21045template<typename R>
21046struct StyleGenericClipRectOrAuto {
21047 enum class Tag : uint8_t {
21048 Auto,
21049 Rect,
21050 };
21051
21052 struct StyleRect_Body {
21053 R _0;
21054
21055 bool operator==(const StyleRect_Body& other) const {
21056 return _0 == other._0;
21057 }
21058 bool operator!=(const StyleRect_Body& other) const {
21059 return _0 != other._0;
21060 }
21061 };
21062
21063 Tag tag;
21064 union {
21065 StyleRect_Body rect;
21066 };
21067
21068 static StyleGenericClipRectOrAuto Auto() {
21069 StyleGenericClipRectOrAuto result;
21070 result.tag = Tag::Auto;
21071 return result;
21072 }
21073
21074 bool IsAuto() const {
21075 return tag == Tag::Auto;
21076 }
21077
21078 static StyleGenericClipRectOrAuto Rect(const R &_0) {
21079 StyleGenericClipRectOrAuto result;
21080 ::new (&result.rect._0) (R)(_0);
21081 result.tag = Tag::Rect;
21082 return result;
21083 }
21084
21085 bool IsRect() const {
21086 return tag == Tag::Rect;
21087 }
21088
21089 const R& AsRect() const {
21090 MOZ_DIAGNOSTIC_ASSERT(IsRect())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRect())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRect()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsRect()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21090); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRect()"
")"); do { *((volatile int*)__null) = 21090; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21091 return rect._0;
21092 }
21093
21094 bool operator==(const StyleGenericClipRectOrAuto& other) const {
21095 if (tag != other.tag) {
21096 return false;
21097 }
21098 switch (tag) {
21099 case Tag::Rect: return rect == other.rect;
21100 default: break;
21101 }
21102 return true;
21103 }
21104
21105 bool operator!=(const StyleGenericClipRectOrAuto& other) const {
21106 return !(*this == other);
21107 }
21108
21109 private:
21110 StyleGenericClipRectOrAuto() {
21111
21112 }
21113 public:
21114
21115
21116 ~StyleGenericClipRectOrAuto() {
21117 switch (tag) {
21118 case Tag::Rect: rect.~StyleRect_Body(); break;
21119 default: break;
21120 }
21121 }
21122
21123 StyleGenericClipRectOrAuto(const StyleGenericClipRectOrAuto& other)
21124 : tag(other.tag) {
21125 switch (tag) {
21126 case Tag::Rect: ::new (&rect) (StyleRect_Body)(other.rect); break;
21127 default: break;
21128 }
21129 }
21130 StyleGenericClipRectOrAuto& operator=(const StyleGenericClipRectOrAuto& other) {
21131 if (this != &other) {
21132 this->~StyleGenericClipRectOrAuto();
21133 new (this) StyleGenericClipRectOrAuto(other);
21134 }
21135 return *this;
21136 }
21137};
21138
21139/// rect(...) | auto
21140using StyleClipRectOrAuto = StyleGenericClipRectOrAuto<StyleClipRect>;
21141
21142/// A name / value pair for counters.
21143template<typename Integer>
21144struct StyleGenericCounterPair {
21145 /// The name of the counter.
21146 StyleCustomIdent name;
21147 /// The value of the counter / increment / etc.
21148 Integer value;
21149 /// If true, then this represents `reversed(name)`.
21150 /// NOTE: It can only be true on `counter-reset` values.
21151 bool is_reversed;
21152
21153 bool operator==(const StyleGenericCounterPair& other) const {
21154 return name == other.name &&
21155 value == other.value &&
21156 is_reversed == other.is_reversed;
21157 }
21158 bool operator!=(const StyleGenericCounterPair& other) const {
21159 return name != other.name ||
21160 value != other.value ||
21161 is_reversed != other.is_reversed;
21162 }
21163};
21164
21165/// A generic value for lists of counters.
21166///
21167/// Keyword `none` is represented by an empty vector.
21168template<typename I>
21169using StyleGenericCounters = StyleOwnedSlice<StyleGenericCounterPair<I>>;
21170
21171/// A generic value for the `counter-reset` property.
21172template<typename I>
21173using StyleGenericCounterReset = StyleGenericCounters<I>;
21174
21175/// A computed value for the `counter-reset` property.
21176using StyleCounterReset = StyleGenericCounterReset<int32_t>;
21177
21178/// A generic value for the `counter-set` property.
21179template<typename I>
21180using StyleGenericCounterSet = StyleGenericCounters<I>;
21181
21182/// A computed value for the `counter-set` property.
21183using StyleCounterSet = StyleGenericCounterSet<int32_t>;
21184
21185/// A generic value for the `counter-increment` property.
21186template<typename I>
21187using StyleGenericCounterIncrement = StyleGenericCounters<I>;
21188
21189/// A computed value for the `counter-increment` property.
21190using StyleCounterIncrement = StyleGenericCounterIncrement<int32_t>;
21191
21192struct StyleWritingMode {
21193 uint8_t _0;
21194
21195 constexpr explicit operator bool() const {
21196 return !!_0;
21197 }
21198 constexpr StyleWritingMode operator~() const {
21199 return StyleWritingMode { static_cast<decltype(_0)>(~_0) };
21200 }
21201 constexpr StyleWritingMode operator|(const StyleWritingMode& other) const {
21202 return StyleWritingMode { static_cast<decltype(_0)>(this->_0 | other._0) };
21203 }
21204 StyleWritingMode& operator|=(const StyleWritingMode& other) {
21205 *this = (*this | other);
21206 return *this;
21207 }
21208 constexpr StyleWritingMode operator&(const StyleWritingMode& other) const {
21209 return StyleWritingMode { static_cast<decltype(_0)>(this->_0 & other._0) };
21210 }
21211 StyleWritingMode& operator&=(const StyleWritingMode& other) {
21212 *this = (*this & other);
21213 return *this;
21214 }
21215 constexpr StyleWritingMode operator^(const StyleWritingMode& other) const {
21216 return StyleWritingMode { static_cast<decltype(_0)>(this->_0 ^ other._0) };
21217 }
21218 StyleWritingMode& operator^=(const StyleWritingMode& other) {
21219 *this = (*this ^ other);
21220 return *this;
21221 }
21222 bool operator==(const StyleWritingMode& other) const {
21223 return _0 == other._0;
21224 }
21225 bool operator!=(const StyleWritingMode& other) const {
21226 return _0 != other._0;
21227 }
21228 static const StyleWritingMode VERTICAL;
21229 static const StyleWritingMode INLINE_REVERSED;
21230 static const StyleWritingMode VERTICAL_LR;
21231 static const StyleWritingMode LINE_INVERTED;
21232 static const StyleWritingMode RTL;
21233 static const StyleWritingMode VERTICAL_SIDEWAYS;
21234 static const StyleWritingMode TEXT_SIDEWAYS;
21235 static const StyleWritingMode UPRIGHT;
21236};
21237/// A vertical writing mode; writing-mode is vertical-rl,
21238/// vertical-lr, sideways-lr, or sideways-rl.
21239constexpr inline const StyleWritingMode StyleWritingMode::VERTICAL = StyleWritingMode{ /* ._0 = */ (uint8_t)(1 << 0) };
21240/// The inline flow direction is reversed against the physical
21241/// direction (i.e. right-to-left or bottom-to-top); writing-mode is
21242/// sideways-lr or direction is rtl (but not both).
21243///
21244/// (This bit can be derived from the others, but we store it for
21245/// convenience.)
21246constexpr inline const StyleWritingMode StyleWritingMode::INLINE_REVERSED = StyleWritingMode{ /* ._0 = */ (uint8_t)(1 << 1) };
21247/// A vertical writing mode whose block progression direction is left-
21248/// to-right; writing-mode is vertical-lr or sideways-lr.
21249///
21250/// Never set without VERTICAL.
21251constexpr inline const StyleWritingMode StyleWritingMode::VERTICAL_LR = StyleWritingMode{ /* ._0 = */ (uint8_t)(1 << 2) };
21252/// The line-over/line-under sides are inverted with respect to the
21253/// block-start/block-end edge; writing-mode is vertical-lr.
21254///
21255/// Never set without VERTICAL and VERTICAL_LR.
21256constexpr inline const StyleWritingMode StyleWritingMode::LINE_INVERTED = StyleWritingMode{ /* ._0 = */ (uint8_t)(1 << 3) };
21257/// direction is rtl.
21258constexpr inline const StyleWritingMode StyleWritingMode::RTL = StyleWritingMode{ /* ._0 = */ (uint8_t)(1 << 4) };
21259/// All text within a vertical writing mode is displayed sideways
21260/// and runs top-to-bottom or bottom-to-top; set in these cases:
21261///
21262/// * writing-mode: sideways-rl;
21263/// * writing-mode: sideways-lr;
21264///
21265/// Never set without VERTICAL.
21266constexpr inline const StyleWritingMode StyleWritingMode::VERTICAL_SIDEWAYS = StyleWritingMode{ /* ._0 = */ (uint8_t)(1 << 5) };
21267/// Similar to VERTICAL_SIDEWAYS, but is set via text-orientation;
21268/// set in these cases:
21269///
21270/// * writing-mode: vertical-rl; text-orientation: sideways;
21271/// * writing-mode: vertical-lr; text-orientation: sideways;
21272///
21273/// Never set without VERTICAL.
21274constexpr inline const StyleWritingMode StyleWritingMode::TEXT_SIDEWAYS = StyleWritingMode{ /* ._0 = */ (uint8_t)(1 << 6) };
21275/// Horizontal text within a vertical writing mode is displayed with each
21276/// glyph upright; set in these cases:
21277///
21278/// * writing-mode: vertical-rl; text-orientation: upright;
21279/// * writing-mode: vertical-lr: text-orientation: upright;
21280///
21281/// Never set without VERTICAL.
21282constexpr inline const StyleWritingMode StyleWritingMode::UPRIGHT = StyleWritingMode{ /* ._0 = */ (uint8_t)(1 << 7) };
21283
21284/// An image or a color. `cross-fade` takes either when blending
21285/// images together.
21286template<typename I, typename C>
21287struct StyleGenericCrossFadeImage {
21288 enum class Tag : uint8_t {
21289 /// A boxed image value. Boxing provides indirection so images can
21290 /// be cross-fades and cross-fades can be images.
21291 Image,
21292 /// A color value.
21293 Color,
21294 };
21295
21296 struct StyleImage_Body {
21297 I _0;
21298
21299 bool operator==(const StyleImage_Body& other) const {
21300 return _0 == other._0;
21301 }
21302 bool operator!=(const StyleImage_Body& other) const {
21303 return _0 != other._0;
21304 }
21305 };
21306
21307 struct StyleColor_Body {
21308 C _0;
21309
21310 bool operator==(const StyleColor_Body& other) const {
21311 return _0 == other._0;
21312 }
21313 bool operator!=(const StyleColor_Body& other) const {
21314 return _0 != other._0;
21315 }
21316 };
21317
21318 Tag tag;
21319 union {
21320 StyleImage_Body image;
21321 StyleColor_Body color;
21322 };
21323
21324 static StyleGenericCrossFadeImage Image(const I &_0) {
21325 StyleGenericCrossFadeImage result;
21326 ::new (&result.image._0) (I)(_0);
21327 result.tag = Tag::Image;
21328 return result;
21329 }
21330
21331 bool IsImage() const {
21332 return tag == Tag::Image;
21333 }
21334
21335 const I& AsImage() const {
21336 MOZ_DIAGNOSTIC_ASSERT(IsImage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsImage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsImage()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsImage()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21336); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsImage()"
")"); do { *((volatile int*)__null) = 21336; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21337 return image._0;
21338 }
21339
21340 static StyleGenericCrossFadeImage Color(const C &_0) {
21341 StyleGenericCrossFadeImage result;
21342 ::new (&result.color._0) (C)(_0);
21343 result.tag = Tag::Color;
21344 return result;
21345 }
21346
21347 bool IsColor() const {
21348 return tag == Tag::Color;
21349 }
21350
21351 const C& AsColor() const {
21352 MOZ_DIAGNOSTIC_ASSERT(IsColor())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsColor())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsColor()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsColor()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21352); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsColor()"
")"); do { *((volatile int*)__null) = 21352; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21353 return color._0;
21354 }
21355
21356 bool operator==(const StyleGenericCrossFadeImage& other) const {
21357 if (tag != other.tag) {
21358 return false;
21359 }
21360 switch (tag) {
21361 case Tag::Image: return image == other.image;
21362 case Tag::Color: return color == other.color;
21363
21364 }
21365 return true;
21366 }
21367
21368 bool operator!=(const StyleGenericCrossFadeImage& other) const {
21369 return !(*this == other);
21370 }
21371
21372 private:
21373 StyleGenericCrossFadeImage() {
21374
21375 }
21376 public:
21377
21378
21379 ~StyleGenericCrossFadeImage() {
21380 switch (tag) {
21381 case Tag::Image: image.~StyleImage_Body(); break;
21382 case Tag::Color: color.~StyleColor_Body(); break;
21383
21384 }
21385 }
21386
21387 StyleGenericCrossFadeImage(const StyleGenericCrossFadeImage& other)
21388 : tag(other.tag) {
21389 switch (tag) {
21390 case Tag::Image: ::new (&image) (StyleImage_Body)(other.image); break;
21391 case Tag::Color: ::new (&color) (StyleColor_Body)(other.color); break;
21392
21393 }
21394 }
21395 StyleGenericCrossFadeImage& operator=(const StyleGenericCrossFadeImage& other) {
21396 if (this != &other) {
21397 this->~StyleGenericCrossFadeImage();
21398 new (this) StyleGenericCrossFadeImage(other);
21399 }
21400 return *this;
21401 }
21402};
21403
21404/// An optional percent and a cross fade image.
21405template<typename Image, typename Color, typename Percentage>
21406struct StyleGenericCrossFadeElement {
21407 /// The percent of the final image that `image` will be.
21408 StyleOptional<Percentage> percent;
21409 /// A color or image that will be blended when cross-fade is
21410 /// evaluated.
21411 StyleGenericCrossFadeImage<Image, Color> image;
21412
21413 bool operator==(const StyleGenericCrossFadeElement& other) const {
21414 return percent == other.percent &&
21415 image == other.image;
21416 }
21417 bool operator!=(const StyleGenericCrossFadeElement& other) const {
21418 return percent != other.percent ||
21419 image != other.image;
21420 }
21421};
21422
21423/// <https://drafts.csswg.org/css-images-4/#cross-fade-function>
21424template<typename Image, typename Color, typename Percentage>
21425struct StyleGenericCrossFade {
21426 /// All of the image percent pairings passed as arguments to
21427 /// cross-fade.
21428 StyleOwnedSlice<StyleGenericCrossFadeElement<Image, Color, Percentage>> elements;
21429
21430 bool operator==(const StyleGenericCrossFade& other) const {
21431 return elements == other.elements;
21432 }
21433 bool operator!=(const StyleGenericCrossFade& other) const {
21434 return elements != other.elements;
21435 }
21436};
21437
21438/// An optional percent and a cross fade image.
21439template<typename Image, typename Resolution>
21440struct StyleGenericImageSetItem {
21441 /// `<image>`. `<string>` is converted to `Image::Url` at parse time.
21442 Image image;
21443 /// The `<resolution>`.
21444 ///
21445 /// TODO: Skip serialization if it is 1x.
21446 Resolution resolution;
21447 /// The `type(<string>)`
21448 /// (Optional) Specify the image's MIME type
21449 StyleOwnedStr mime_type;
21450 /// True if mime_type has been specified
21451 bool has_mime_type;
21452
21453 bool operator==(const StyleGenericImageSetItem& other) const {
21454 return image == other.image &&
21455 resolution == other.resolution &&
21456 mime_type == other.mime_type &&
21457 has_mime_type == other.has_mime_type;
21458 }
21459 bool operator!=(const StyleGenericImageSetItem& other) const {
21460 return image != other.image ||
21461 resolution != other.resolution ||
21462 mime_type != other.mime_type ||
21463 has_mime_type != other.has_mime_type;
21464 }
21465};
21466
21467/// https://drafts.csswg.org/css-images-4/#image-set-notation
21468template<typename Image, typename Resolution>
21469struct StyleGenericImageSet {
21470 /// The index of the selected candidate. usize::MAX for specified values or invalid images.
21471 uintptr_t selected_index;
21472 /// All of the image and resolution pairs.
21473 StyleOwnedSlice<StyleGenericImageSetItem<Image, Resolution>> items;
21474
21475 bool operator==(const StyleGenericImageSet& other) const {
21476 return selected_index == other.selected_index &&
21477 items == other.items;
21478 }
21479 bool operator!=(const StyleGenericImageSet& other) const {
21480 return selected_index != other.selected_index ||
21481 items != other.items;
21482 }
21483};
21484
21485/// An `<image> | none` value.
21486///
21487/// https://drafts.csswg.org/css-images/#image-values
21488template<typename G, typename ImageUrl, typename Color, typename Percentage, typename Resolution>
21489struct StyleGenericImage {
21490 enum class Tag : uint8_t {
21491 /// `none` variant.
21492 None,
21493 /// A `<url()>` image.
21494 Url,
21495 /// A `<gradient>` image. Gradients are rather large, and not nearly as
21496 /// common as urls, so we box them here to keep the size of this enum sane.
21497 Gradient,
21498#if defined(CBINDGEN_IS_GECKO)
21499 /// A `-moz-element(# <element-id>)`
21500 Element,
21501#endif
21502#if defined(CBINDGEN_IS_SERVO)
21503 /// A paint worklet image.
21504 /// <https://drafts.css-houdini.org/css-paint-api/>
21505 PaintWorklet,
21506#endif
21507 /// A `<cross-fade()>` image. Storing this directly inside of
21508 /// GenericImage increases the size by 8 bytes so we box it here
21509 /// and store images directly inside of cross-fade instead of
21510 /// boxing them there.
21511 CrossFade,
21512 /// An `image-set()` function.
21513 ImageSet,
21514 };
21515
21516 struct StyleUrl_Body {
21517 ImageUrl _0;
21518
21519 bool operator==(const StyleUrl_Body& other) const {
21520 return _0 == other._0;
21521 }
21522 bool operator!=(const StyleUrl_Body& other) const {
21523 return _0 != other._0;
21524 }
21525 };
21526
21527 struct StyleGradient_Body {
21528 StyleBox<G> _0;
21529
21530 bool operator==(const StyleGradient_Body& other) const {
21531 return _0 == other._0;
21532 }
21533 bool operator!=(const StyleGradient_Body& other) const {
21534 return _0 != other._0;
21535 }
21536 };
21537
21538#if defined(CBINDGEN_IS_GECKO)
21539 struct StyleElement_Body {
21540 StyleAtom _0;
21541
21542 bool operator==(const StyleElement_Body& other) const {
21543 return _0 == other._0;
21544 }
21545 bool operator!=(const StyleElement_Body& other) const {
21546 return _0 != other._0;
21547 }
21548 };
21549#endif
21550
21551#if defined(CBINDGEN_IS_SERVO)
21552 struct StylePaintWorklet_Body {
21553 StylePaintWorklet _0;
21554
21555 bool operator==(const StylePaintWorklet_Body& other) const {
21556 return _0 == other._0;
21557 }
21558 bool operator!=(const StylePaintWorklet_Body& other) const {
21559 return _0 != other._0;
21560 }
21561 };
21562#endif
21563
21564 struct StyleCrossFade_Body {
21565 StyleBox<StyleGenericCrossFade<StyleGenericImage, Color, Percentage>> _0;
21566
21567 bool operator==(const StyleCrossFade_Body& other) const {
21568 return _0 == other._0;
21569 }
21570 bool operator!=(const StyleCrossFade_Body& other) const {
21571 return _0 != other._0;
21572 }
21573 };
21574
21575 struct StyleImageSet_Body {
21576 StyleBox<StyleGenericImageSet<StyleGenericImage, Resolution>> _0;
21577
21578 bool operator==(const StyleImageSet_Body& other) const {
21579 return _0 == other._0;
21580 }
21581 bool operator!=(const StyleImageSet_Body& other) const {
21582 return _0 != other._0;
21583 }
21584 };
21585
21586 Tag tag;
21587 union {
21588 StyleUrl_Body url;
21589 StyleGradient_Body gradient;
21590#if defined(CBINDGEN_IS_GECKO)
21591 StyleElement_Body element;
21592#endif
21593#if defined(CBINDGEN_IS_SERVO)
21594 StylePaintWorklet_Body paint_worklet;
21595#endif
21596 StyleCrossFade_Body cross_fade;
21597 StyleImageSet_Body image_set;
21598 };
21599
21600 static StyleGenericImage None() {
21601 StyleGenericImage result;
21602 result.tag = Tag::None;
21603 return result;
21604 }
21605
21606 bool IsNone() const {
21607 return tag == Tag::None;
21608 }
21609
21610 static StyleGenericImage Url(const ImageUrl &_0) {
21611 StyleGenericImage result;
21612 ::new (&result.url._0) (ImageUrl)(_0);
21613 result.tag = Tag::Url;
21614 return result;
21615 }
21616
21617 bool IsUrl() const {
21618 return tag == Tag::Url;
21619 }
21620
21621 const ImageUrl& AsUrl() const {
21622 MOZ_DIAGNOSTIC_ASSERT(IsUrl())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsUrl())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsUrl()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsUrl()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21622); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsUrl()"
")"); do { *((volatile int*)__null) = 21622; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21623 return url._0;
21624 }
21625
21626 static StyleGenericImage Gradient(const StyleBox<G> &_0) {
21627 StyleGenericImage result;
21628 ::new (&result.gradient._0) (StyleBox<G>)(_0);
21629 result.tag = Tag::Gradient;
21630 return result;
21631 }
21632
21633 bool IsGradient() const {
21634 return tag == Tag::Gradient;
21635 }
21636
21637 const StyleBox<G>& AsGradient() const {
21638 MOZ_DIAGNOSTIC_ASSERT(IsGradient())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsGradient())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsGradient()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsGradient()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21638); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsGradient()"
")"); do { *((volatile int*)__null) = 21638; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21639 return gradient._0;
21640 }
21641
21642#if defined(CBINDGEN_IS_GECKO)
21643 static StyleGenericImage Element(const StyleAtom &_0) {
21644 StyleGenericImage result;
21645 ::new (&result.element._0) (StyleAtom)(_0);
21646 result.tag = Tag::Element;
21647 return result;
21648 }
21649
21650 bool IsElement() const {
21651 return tag == Tag::Element;
21652 }
21653
21654 const StyleAtom& AsElement() const {
21655 MOZ_DIAGNOSTIC_ASSERT(IsElement())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsElement())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsElement()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsElement()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21655); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsElement()"
")"); do { *((volatile int*)__null) = 21655; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21656 return element._0;
21657 }
21658#endif
21659
21660#if defined(CBINDGEN_IS_SERVO)
21661 static StyleGenericImage PaintWorklet(const StylePaintWorklet &_0) {
21662 StyleGenericImage result;
21663 ::new (&result.paint_worklet._0) (StylePaintWorklet)(_0);
21664 result.tag = Tag::PaintWorklet;
21665 return result;
21666 }
21667
21668 bool IsPaintWorklet() const {
21669 return tag == Tag::PaintWorklet;
21670 }
21671
21672 const StylePaintWorklet& AsPaintWorklet() const {
21673 MOZ_DIAGNOSTIC_ASSERT(IsPaintWorklet())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPaintWorklet())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPaintWorklet()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPaintWorklet()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21673); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPaintWorklet()"
")"); do { *((volatile int*)__null) = 21673; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21674 return paint_worklet._0;
21675 }
21676#endif
21677
21678 static StyleGenericImage CrossFade(const StyleBox<StyleGenericCrossFade<StyleGenericImage, Color, Percentage>> &_0) {
21679 StyleGenericImage result;
21680 ::new (&result.cross_fade._0) (StyleBox<StyleGenericCrossFade<StyleGenericImage, Color, Percentage>>)(_0);
21681 result.tag = Tag::CrossFade;
21682 return result;
21683 }
21684
21685 bool IsCrossFade() const {
21686 return tag == Tag::CrossFade;
21687 }
21688
21689 const StyleBox<StyleGenericCrossFade<StyleGenericImage, Color, Percentage>>& AsCrossFade() const {
21690 MOZ_DIAGNOSTIC_ASSERT(IsCrossFade())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCrossFade())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCrossFade()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsCrossFade()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21690); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCrossFade()"
")"); do { *((volatile int*)__null) = 21690; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21691 return cross_fade._0;
21692 }
21693
21694 static StyleGenericImage ImageSet(const StyleBox<StyleGenericImageSet<StyleGenericImage, Resolution>> &_0) {
21695 StyleGenericImage result;
21696 ::new (&result.image_set._0) (StyleBox<StyleGenericImageSet<StyleGenericImage, Resolution>>)(_0);
21697 result.tag = Tag::ImageSet;
21698 return result;
21699 }
21700
21701 bool IsImageSet() const {
21702 return tag == Tag::ImageSet;
21703 }
21704
21705 const StyleBox<StyleGenericImageSet<StyleGenericImage, Resolution>>& AsImageSet() const {
21706 MOZ_DIAGNOSTIC_ASSERT(IsImageSet())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsImageSet())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsImageSet()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsImageSet()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21706); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsImageSet()"
")"); do { *((volatile int*)__null) = 21706; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21707 return image_set._0;
21708 }
21709
21710 bool operator==(const StyleGenericImage& other) const {
21711 if (tag != other.tag) {
21712 return false;
21713 }
21714 switch (tag) {
21715 case Tag::Url: return url == other.url;
21716 case Tag::Gradient: return gradient == other.gradient;
21717#if defined(CBINDGEN_IS_GECKO)
21718 case Tag::Element: return element == other.element;
21719#endif
21720#if defined(CBINDGEN_IS_SERVO)
21721 case Tag::PaintWorklet: return paint_worklet == other.paint_worklet;
21722#endif
21723 case Tag::CrossFade: return cross_fade == other.cross_fade;
21724 case Tag::ImageSet: return image_set == other.image_set;
21725 default: break;
21726 }
21727 return true;
21728 }
21729
21730 bool operator!=(const StyleGenericImage& other) const {
21731 return !(*this == other);
21732 }
21733
21734 private:
21735 StyleGenericImage() {
21736
21737 }
21738 public:
21739
21740
21741 ~StyleGenericImage() {
21742 switch (tag) {
21743 case Tag::Url: url.~StyleUrl_Body(); break;
21744 case Tag::Gradient: gradient.~StyleGradient_Body(); break;
21745#if defined(CBINDGEN_IS_GECKO)
21746 case Tag::Element: element.~StyleElement_Body(); break;
21747#endif
21748#if defined(CBINDGEN_IS_SERVO)
21749 case Tag::PaintWorklet: paint_worklet.~StylePaintWorklet_Body(); break;
21750#endif
21751 case Tag::CrossFade: cross_fade.~StyleCrossFade_Body(); break;
21752 case Tag::ImageSet: image_set.~StyleImageSet_Body(); break;
21753 default: break;
21754 }
21755 }
21756
21757 StyleGenericImage(const StyleGenericImage& other)
21758 : tag(other.tag) {
21759 switch (tag) {
21760 case Tag::Url: ::new (&url) (StyleUrl_Body)(other.url); break;
21761 case Tag::Gradient: ::new (&gradient) (StyleGradient_Body)(other.gradient); break;
21762#if defined(CBINDGEN_IS_GECKO)
21763 case Tag::Element: ::new (&element) (StyleElement_Body)(other.element); break;
21764#endif
21765#if defined(CBINDGEN_IS_SERVO)
21766 case Tag::PaintWorklet: ::new (&paint_worklet) (StylePaintWorklet_Body)(other.paint_worklet); break;
21767#endif
21768 case Tag::CrossFade: ::new (&cross_fade) (StyleCrossFade_Body)(other.cross_fade); break;
21769 case Tag::ImageSet: ::new (&image_set) (StyleImageSet_Body)(other.image_set); break;
21770 default: break;
21771 }
21772 }
21773 StyleGenericImage& operator=(const StyleGenericImage& other) {
21774 if (this != &other) {
21775 this->~StyleGenericImage();
21776 new (this) StyleGenericImage(other);
21777 }
21778 return *this;
21779 }
21780 public:
21781 // Returns the intrinsic resolution of the image.
21782 //
21783 // The resolution is in dppx, and should be used to impact the intrinsic
21784 // size of the image.
21785 ImageResolution GetResolution(const ComputedStyle&) const;
21786
21787 // If this is an image-set(), the final image we've selected, otherwise it
21788 // returns *this.
21789 const StyleGenericImage& FinalImage() const;
21790
21791 // Whether this image may have an image request associated with it.
21792 bool IsImageRequestType() const;
21793
21794 // Gets the image request URL.
21795 const StyleComputedImageUrl* GetImageRequestURLValue() const;
21796
21797 // Gets the image data of this image if it has any image request.
21798 imgRequestProxy* GetImageRequest() const;
21799
21800 // Returns true if this image is fully loaded, and its size is calculated.
21801 // Always returns true if there's no image request involved and this image
21802 // is not `none`.
21803 bool IsComplete() const;
21804
21805 // Returns true if this image has an available size and hasn't errored.
21806 // Always returns true if there's no image request involved and this image
21807 // is not `none`.
21808 bool IsSizeAvailable() const;
21809
21810 // Returns true if the item is definitely opaque --- i.e., paints every
21811 // pixel within its bounds opaquely, and the bounds contains at least a pixel.
21812 bool IsOpaque() const;
21813
21814 // Resolves the underlying image request if any.
21815 void ResolveImage(dom::Document&, const StyleGenericImage* aOld);
21816
21817 // Returns whether this image has been resolved.
21818 bool IsResolved() const;
21819};
21820
21821/// Computed values for an image according to CSS-IMAGES.
21822/// <https://drafts.csswg.org/css-images/#image-values>
21823using StyleImage = StyleGenericImage<StyleGradient, StyleComputedImageUrl, StyleColor, StylePercentage, StyleResolution>;
21824
21825/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols>
21826struct StyleSymbols {
21827 StyleArcSlice<StyleSymbol> _0;
21828
21829 bool operator==(const StyleSymbols& other) const {
21830 return _0 == other._0;
21831 }
21832 bool operator!=(const StyleSymbols& other) const {
21833 return _0 != other._0;
21834 }
21835};
21836
21837/// <https://drafts.csswg.org/css-counter-styles/#typedef-counter-style>
21838///
21839/// Note that 'none' is not a valid name, but we include this (along with String) for space
21840/// efficiency when storing list-style-type.
21841union StyleCounterStyle {
21842 enum class Tag : uint8_t {
21843 /// The 'none' value.
21844 None,
21845 /// `<counter-style-name>`
21846 Name,
21847 /// `symbols()`
21848 Symbols,
21849 /// A single string value, useful for `<list-style-type>`.
21850 String,
21851 };
21852
21853 struct Name_Body {
21854 Tag tag;
21855 StyleCustomIdent _0;
21856
21857 bool operator==(const Name_Body& other) const {
21858 return _0 == other._0;
21859 }
21860 bool operator!=(const Name_Body& other) const {
21861 return _0 != other._0;
21862 }
21863 };
21864
21865 struct Symbols_Body {
21866 Tag tag;
21867 /// The <symbols-type>, or symbolic if not specified.
21868 StyleSymbolsType ty;
21869 /// The actual symbols.
21870 StyleSymbols symbols;
21871
21872 bool operator==(const Symbols_Body& other) const {
21873 return ty == other.ty &&
21874 symbols == other.symbols;
21875 }
21876 bool operator!=(const Symbols_Body& other) const {
21877 return ty != other.ty ||
21878 symbols != other.symbols;
21879 }
21880 };
21881
21882 struct String_Body {
21883 Tag tag;
21884 StyleAtomString _0;
21885
21886 bool operator==(const String_Body& other) const {
21887 return _0 == other._0;
21888 }
21889 bool operator!=(const String_Body& other) const {
21890 return _0 != other._0;
21891 }
21892 };
21893
21894 struct {
21895 Tag tag;
21896 };
21897 Name_Body name;
21898 Symbols_Body symbols;
21899 String_Body string;
21900
21901 static StyleCounterStyle None() {
21902 StyleCounterStyle result;
21903 result.tag = Tag::None;
21904 return result;
21905 }
21906
21907 bool IsNone() const {
21908 return tag == Tag::None;
21909 }
21910
21911 static StyleCounterStyle Name(const StyleCustomIdent &_0) {
21912 StyleCounterStyle result;
21913 ::new (&result.name._0) (StyleCustomIdent)(_0);
21914 result.tag = Tag::Name;
21915 return result;
21916 }
21917
21918 bool IsName() const {
21919 return tag == Tag::Name;
21920 }
21921
21922 const StyleCustomIdent& AsName() const {
21923 MOZ_DIAGNOSTIC_ASSERT(IsName())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsName())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsName()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsName()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21923); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsName()"
")"); do { *((volatile int*)__null) = 21923; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21924 return name._0;
21925 }
21926
21927 static StyleCounterStyle Symbols(const StyleSymbolsType &ty,
21928 const StyleSymbols &symbols) {
21929 StyleCounterStyle result;
21930 ::new (&result.symbols.ty) (StyleSymbolsType)(ty);
21931 ::new (&result.symbols.symbols) (StyleSymbols)(symbols);
21932 result.tag = Tag::Symbols;
21933 return result;
21934 }
21935
21936 bool IsSymbols() const {
21937 return tag == Tag::Symbols;
21938 }
21939
21940 const Symbols_Body& AsSymbols() const {
21941 MOZ_DIAGNOSTIC_ASSERT(IsSymbols())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSymbols())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSymbols()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsSymbols()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21941); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSymbols()"
")"); do { *((volatile int*)__null) = 21941; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21942 return symbols;
21943 }
21944
21945 static StyleCounterStyle String(const StyleAtomString &_0) {
21946 StyleCounterStyle result;
21947 ::new (&result.string._0) (StyleAtomString)(_0);
21948 result.tag = Tag::String;
21949 return result;
21950 }
21951
21952 bool IsString() const {
21953 return tag == Tag::String;
21954 }
21955
21956 const StyleAtomString& AsString() const {
21957 MOZ_DIAGNOSTIC_ASSERT(IsString())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsString())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsString()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsString()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 21957); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsString()"
")"); do { *((volatile int*)__null) = 21957; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
21958 return string._0;
21959 }
21960
21961 bool operator==(const StyleCounterStyle& other) const {
21962 if (tag != other.tag) {
21963 return false;
21964 }
21965 switch (tag) {
21966 case Tag::Name: return name == other.name;
21967 case Tag::Symbols: return symbols == other.symbols;
21968 case Tag::String: return string == other.string;
21969 default: break;
21970 }
21971 return true;
21972 }
21973
21974 bool operator!=(const StyleCounterStyle& other) const {
21975 return !(*this == other);
21976 }
21977
21978 private:
21979 StyleCounterStyle() {
21980
21981 }
21982 public:
21983
21984
21985 ~StyleCounterStyle() {
21986 switch (tag) {
21987 case Tag::Name: name.~Name_Body(); break;
21988 case Tag::Symbols: symbols.~Symbols_Body(); break;
21989 case Tag::String: string.~String_Body(); break;
21990 default: break;
21991 }
21992 }
21993
21994 StyleCounterStyle(const StyleCounterStyle& other)
21995 : tag(other.tag) {
21996 switch (tag) {
21997 case Tag::Name: ::new (&name) (Name_Body)(other.name); break;
21998 case Tag::Symbols: ::new (&symbols) (Symbols_Body)(other.symbols); break;
21999 case Tag::String: ::new (&string) (String_Body)(other.string); break;
22000 default: break;
22001 }
22002 }
22003 StyleCounterStyle& operator=(const StyleCounterStyle& other) {
22004 if (this != &other) {
22005 this->~StyleCounterStyle();
22006 new (this) StyleCounterStyle(other);
22007 }
22008 return *this;
22009 }
22010};
22011
22012#if defined(CBINDGEN_IS_GECKO)
22013/// Specified and computed `list-style-type` property.
22014using StyleListStyleType = StyleCounterStyle;
22015#endif
22016
22017#if defined(CBINDGEN_IS_SERVO)
22018using StyleCounterStyleType = StyleListStyleType;
22019#endif
22020
22021#if defined(CBINDGEN_IS_GECKO)
22022using StyleCounterStyleType = StyleCounterStyle;
22023#endif
22024
22025#if defined(CBINDGEN_IS_GECKO)
22026/// A CSS `<ident>` stored as an `Atom`.
22027using StyleAtomIdent = StyleAtom;
22028#endif
22029
22030#if defined(CBINDGEN_IS_SERVO)
22031/// A generic CSS `<ident>` stored as an `Atom`.
22032template<typename Set>
22033using StyleGenericAtomIdent = StyleAtom<Set>;
22034#endif
22035
22036#if defined(CBINDGEN_IS_GECKO)
22037/// The namespace prefix type for Gecko, which is just an atom.
22038using StylePrefix = StyleAtomIdent;
22039#endif
22040
22041#if defined(CBINDGEN_IS_SERVO)
22042using StylePrefix = StyleGenericAtomIdent<StylePrefixStaticSet>;
22043#endif
22044
22045#if defined(CBINDGEN_IS_GECKO)
22046/// A Gecko namespace is just a wrapped atom.
22047using StyleNamespace = StyleAtom;
22048#endif
22049
22050/// An attr(...) rule
22051///
22052/// `[namespace? `|`]? ident`
22053struct StyleAttr {
22054 /// Optional namespace prefix.
22055 StylePrefix namespace_prefix;
22056 /// Optional namespace URL.
22057 StyleNamespace namespace_url;
22058 /// Attribute name
22059 StyleAtom attribute;
22060 /// Fallback value
22061 StyleAtomString fallback;
22062
22063 bool operator==(const StyleAttr& other) const {
22064 return namespace_prefix == other.namespace_prefix &&
22065 namespace_url == other.namespace_url &&
22066 attribute == other.attribute &&
22067 fallback == other.fallback;
22068 }
22069 bool operator!=(const StyleAttr& other) const {
22070 return namespace_prefix != other.namespace_prefix ||
22071 namespace_url != other.namespace_url ||
22072 attribute != other.attribute ||
22073 fallback != other.fallback;
22074 }
22075};
22076
22077/// Items for the `content` property.
22078template<typename I>
22079union StyleGenericContentItem {
22080 enum class Tag : uint8_t {
22081 /// Literal string content.
22082 String,
22083 /// `counter(name, style)`.
22084 Counter,
22085 /// `counters(name, separator, style)`.
22086 Counters,
22087 /// `open-quote`.
22088 OpenQuote,
22089 /// `close-quote`.
22090 CloseQuote,
22091 /// `no-open-quote`.
22092 NoOpenQuote,
22093 /// `no-close-quote`.
22094 NoCloseQuote,
22095#if defined(CBINDGEN_IS_GECKO)
22096 /// `-moz-alt-content`.
22097 MozAltContent,
22098#endif
22099#if defined(CBINDGEN_IS_GECKO)
22100 /// `-moz-label-content`.
22101 /// This is needed to make `accesskey` work for XUL labels. It's basically
22102 /// attr(value) otherwise.
22103 MozLabelContent,
22104#endif
22105 /// `attr([namespace? `|`]? ident)`
22106 Attr,
22107 /// image-set(url) | url(url)
22108 Image,
22109 };
22110
22111 struct String_Body {
22112 Tag tag;
22113 StyleOwnedStr _0;
22114
22115 bool operator==(const String_Body& other) const {
22116 return _0 == other._0;
22117 }
22118 bool operator!=(const String_Body& other) const {
22119 return _0 != other._0;
22120 }
22121 };
22122
22123 struct Counter_Body {
22124 Tag tag;
22125 StyleCustomIdent _0;
22126 StyleCounterStyleType _1;
22127
22128 bool operator==(const Counter_Body& other) const {
22129 return _0 == other._0 &&
22130 _1 == other._1;
22131 }
22132 bool operator!=(const Counter_Body& other) const {
22133 return _0 != other._0 ||
22134 _1 != other._1;
22135 }
22136 };
22137
22138 struct Counters_Body {
22139 Tag tag;
22140 StyleCustomIdent _0;
22141 StyleOwnedStr _1;
22142 StyleCounterStyleType _2;
22143
22144 bool operator==(const Counters_Body& other) const {
22145 return _0 == other._0 &&
22146 _1 == other._1 &&
22147 _2 == other._2;
22148 }
22149 bool operator!=(const Counters_Body& other) const {
22150 return _0 != other._0 ||
22151 _1 != other._1 ||
22152 _2 != other._2;
22153 }
22154 };
22155
22156 struct Attr_Body {
22157 Tag tag;
22158 StyleAttr _0;
22159
22160 bool operator==(const Attr_Body& other) const {
22161 return _0 == other._0;
22162 }
22163 bool operator!=(const Attr_Body& other) const {
22164 return _0 != other._0;
22165 }
22166 };
22167
22168 struct Image_Body {
22169 Tag tag;
22170 I _0;
22171
22172 bool operator==(const Image_Body& other) const {
22173 return _0 == other._0;
22174 }
22175 bool operator!=(const Image_Body& other) const {
22176 return _0 != other._0;
22177 }
22178 };
22179
22180 struct {
22181 Tag tag;
22182 };
22183 String_Body string;
22184 Counter_Body counter;
22185 Counters_Body counters;
22186 Attr_Body attr;
22187 Image_Body image;
22188
22189 static StyleGenericContentItem String(const StyleOwnedStr &_0) {
22190 StyleGenericContentItem result;
22191 ::new (&result.string._0) (StyleOwnedStr)(_0);
22192 result.tag = Tag::String;
22193 return result;
22194 }
22195
22196 bool IsString() const {
22197 return tag == Tag::String;
22198 }
22199
22200 const StyleOwnedStr& AsString() const {
22201 MOZ_DIAGNOSTIC_ASSERT(IsString())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsString())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsString()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsString()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 22201); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsString()"
")"); do { *((volatile int*)__null) = 22201; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
22202 return string._0;
22203 }
22204
22205 static StyleGenericContentItem Counter(const StyleCustomIdent &_0,
22206 const StyleCounterStyleType &_1) {
22207 StyleGenericContentItem result;
22208 ::new (&result.counter._0) (StyleCustomIdent)(_0);
22209 ::new (&result.counter._1) (StyleCounterStyleType)(_1);
22210 result.tag = Tag::Counter;
22211 return result;
22212 }
22213
22214 bool IsCounter() const {
22215 return tag == Tag::Counter;
22216 }
22217
22218 const Counter_Body& AsCounter() const {
22219 MOZ_DIAGNOSTIC_ASSERT(IsCounter())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCounter())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCounter()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsCounter()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 22219); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCounter()"
")"); do { *((volatile int*)__null) = 22219; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
22220 return counter;
22221 }
22222
22223 static StyleGenericContentItem Counters(const StyleCustomIdent &_0,
22224 const StyleOwnedStr &_1,
22225 const StyleCounterStyleType &_2) {
22226 StyleGenericContentItem result;
22227 ::new (&result.counters._0) (StyleCustomIdent)(_0);
22228 ::new (&result.counters._1) (StyleOwnedStr)(_1);
22229 ::new (&result.counters._2) (StyleCounterStyleType)(_2);
22230 result.tag = Tag::Counters;
22231 return result;
22232 }
22233
22234 bool IsCounters() const {
22235 return tag == Tag::Counters;
22236 }
22237
22238 const Counters_Body& AsCounters() const {
22239 MOZ_DIAGNOSTIC_ASSERT(IsCounters())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCounters())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCounters()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsCounters()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 22239); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCounters()"
")"); do { *((volatile int*)__null) = 22239; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
22240 return counters;
22241 }
22242
22243 static StyleGenericContentItem OpenQuote() {
22244 StyleGenericContentItem result;
22245 result.tag = Tag::OpenQuote;
22246 return result;
22247 }
22248
22249 bool IsOpenQuote() const {
22250 return tag == Tag::OpenQuote;
22251 }
22252
22253 static StyleGenericContentItem CloseQuote() {
22254 StyleGenericContentItem result;
22255 result.tag = Tag::CloseQuote;
22256 return result;
22257 }
22258
22259 bool IsCloseQuote() const {
22260 return tag == Tag::CloseQuote;
22261 }
22262
22263 static StyleGenericContentItem NoOpenQuote() {
22264 StyleGenericContentItem result;
22265 result.tag = Tag::NoOpenQuote;
22266 return result;
22267 }
22268
22269 bool IsNoOpenQuote() const {
22270 return tag == Tag::NoOpenQuote;
22271 }
22272
22273 static StyleGenericContentItem NoCloseQuote() {
22274 StyleGenericContentItem result;
22275 result.tag = Tag::NoCloseQuote;
22276 return result;
22277 }
22278
22279 bool IsNoCloseQuote() const {
22280 return tag == Tag::NoCloseQuote;
22281 }
22282
22283#if defined(CBINDGEN_IS_GECKO)
22284 static StyleGenericContentItem MozAltContent() {
22285 StyleGenericContentItem result;
22286 result.tag = Tag::MozAltContent;
22287 return result;
22288 }
22289
22290 bool IsMozAltContent() const {
22291 return tag == Tag::MozAltContent;
22292 }
22293#endif
22294
22295#if defined(CBINDGEN_IS_GECKO)
22296 static StyleGenericContentItem MozLabelContent() {
22297 StyleGenericContentItem result;
22298 result.tag = Tag::MozLabelContent;
22299 return result;
22300 }
22301
22302 bool IsMozLabelContent() const {
22303 return tag == Tag::MozLabelContent;
22304 }
22305#endif
22306
22307 static StyleGenericContentItem Attr(const StyleAttr &_0) {
22308 StyleGenericContentItem result;
22309 ::new (&result.attr._0) (StyleAttr)(_0);
22310 result.tag = Tag::Attr;
22311 return result;
22312 }
22313
22314 bool IsAttr() const {
22315 return tag == Tag::Attr;
22316 }
22317
22318 const StyleAttr& AsAttr() const {
22319 MOZ_DIAGNOSTIC_ASSERT(IsAttr())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAttr())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAttr()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsAttr()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 22319); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAttr()"
")"); do { *((volatile int*)__null) = 22319; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
22320 return attr._0;
22321 }
22322
22323 static StyleGenericContentItem Image(const I &_0) {
22324 StyleGenericContentItem result;
22325 ::new (&result.image._0) (I)(_0);
22326 result.tag = Tag::Image;
22327 return result;
22328 }
22329
22330 bool IsImage() const {
22331 return tag == Tag::Image;
22332 }
22333
22334 const I& AsImage() const {
22335 MOZ_DIAGNOSTIC_ASSERT(IsImage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsImage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsImage()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsImage()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 22335); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsImage()"
")"); do { *((volatile int*)__null) = 22335; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
22336 return image._0;
22337 }
22338
22339 bool operator==(const StyleGenericContentItem& other) const {
22340 if (tag != other.tag) {
22341 return false;
22342 }
22343 switch (tag) {
22344 case Tag::String: return string == other.string;
22345 case Tag::Counter: return counter == other.counter;
22346 case Tag::Counters: return counters == other.counters;
22347 case Tag::Attr: return attr == other.attr;
22348 case Tag::Image: return image == other.image;
22349 default: break;
22350 }
22351 return true;
22352 }
22353
22354 bool operator!=(const StyleGenericContentItem& other) const {
22355 return !(*this == other);
22356 }
22357
22358 private:
22359 StyleGenericContentItem() {
22360
22361 }
22362 public:
22363
22364
22365 ~StyleGenericContentItem() {
22366 switch (tag) {
22367 case Tag::String: string.~String_Body(); break;
22368 case Tag::Counter: counter.~Counter_Body(); break;
22369 case Tag::Counters: counters.~Counters_Body(); break;
22370 case Tag::Attr: attr.~Attr_Body(); break;
22371 case Tag::Image: image.~Image_Body(); break;
22372 default: break;
22373 }
22374 }
22375
22376 StyleGenericContentItem(const StyleGenericContentItem& other)
22377 : tag(other.tag) {
22378 switch (tag) {
22379 case Tag::String: ::new (&string) (String_Body)(other.string); break;
22380 case Tag::Counter: ::new (&counter) (Counter_Body)(other.counter); break;
22381 case Tag::Counters: ::new (&counters) (Counters_Body)(other.counters); break;
22382 case Tag::Attr: ::new (&attr) (Attr_Body)(other.attr); break;
22383 case Tag::Image: ::new (&image) (Image_Body)(other.image); break;
22384 default: break;
22385 }
22386 }
22387 StyleGenericContentItem& operator=(const StyleGenericContentItem& other) {
22388 if (this != &other) {
22389 this->~StyleGenericContentItem();
22390 new (this) StyleGenericContentItem(other);
22391 }
22392 return *this;
22393 }
22394};
22395
22396/// The non-normal, non-none values of the content property.
22397template<typename Image>
22398struct StyleGenericContentItems {
22399 /// The actual content items. Note that, past the alt marker, only some subset (strings,
22400 /// attr(), counter())
22401 CopyableTArray<StyleGenericContentItem<Image>> items;
22402 /// The index at which alt text starts, always non-zero. If equal to items.len(), no alt text
22403 /// exists.
22404 uintptr_t alt_start;
22405
22406 bool operator==(const StyleGenericContentItems& other) const {
22407 return items == other.items &&
22408 alt_start == other.alt_start;
22409 }
22410 bool operator!=(const StyleGenericContentItems& other) const {
22411 return items != other.items ||
22412 alt_start != other.alt_start;
22413 }
22414};
22415
22416/// The specified value for the `content` property.
22417///
22418/// https://drafts.csswg.org/css-content/#propdef-content
22419template<typename Image>
22420union StyleGenericContent {
22421 enum class Tag : uint8_t {
22422 /// `normal` reserved keyword.
22423 Normal,
22424 /// `none` reserved keyword.
22425 None,
22426 /// Content items.
22427 Items,
22428 };
22429
22430 struct Items_Body {
22431 Tag tag;
22432 StyleGenericContentItems<Image> _0;
22433
22434 bool operator==(const Items_Body& other) const {
22435 return _0 == other._0;
22436 }
22437 bool operator!=(const Items_Body& other) const {
22438 return _0 != other._0;
22439 }
22440 };
22441
22442 struct {
22443 Tag tag;
22444 };
22445 Items_Body items;
22446
22447 static StyleGenericContent Normal() {
22448 StyleGenericContent result;
22449 result.tag = Tag::Normal;
22450 return result;
22451 }
22452
22453 bool IsNormal() const {
22454 return tag == Tag::Normal;
22455 }
22456
22457 static StyleGenericContent None() {
22458 StyleGenericContent result;
22459 result.tag = Tag::None;
22460 return result;
22461 }
22462
22463 bool IsNone() const {
22464 return tag == Tag::None;
22465 }
22466
22467 static StyleGenericContent Items(const StyleGenericContentItems<Image> &_0) {
22468 StyleGenericContent result;
22469 ::new (&result.items._0) (StyleGenericContentItems<Image>)(_0);
22470 result.tag = Tag::Items;
22471 return result;
22472 }
22473
22474 bool IsItems() const {
22475 return tag == Tag::Items;
22476 }
22477
22478 const StyleGenericContentItems<Image>& AsItems() const {
22479 MOZ_DIAGNOSTIC_ASSERT(IsItems())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsItems())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsItems()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsItems()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 22479); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsItems()"
")"); do { *((volatile int*)__null) = 22479; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
22480 return items._0;
22481 }
22482
22483 bool operator==(const StyleGenericContent& other) const {
22484 if (tag != other.tag) {
22485 return false;
22486 }
22487 switch (tag) {
22488 case Tag::Items: return items == other.items;
22489 default: break;
22490 }
22491 return true;
22492 }
22493
22494 bool operator!=(const StyleGenericContent& other) const {
22495 return !(*this == other);
22496 }
22497
22498 private:
22499 StyleGenericContent() {
22500
22501 }
22502 public:
22503
22504
22505 ~StyleGenericContent() {
22506 switch (tag) {
22507 case Tag::Items: items.~Items_Body(); break;
22508 default: break;
22509 }
22510 }
22511
22512 StyleGenericContent(const StyleGenericContent& other)
22513 : tag(other.tag) {
22514 switch (tag) {
22515 case Tag::Items: ::new (&items) (Items_Body)(other.items); break;
22516 default: break;
22517 }
22518 }
22519 StyleGenericContent& operator=(const StyleGenericContent& other) {
22520 if (this != &other) {
22521 this->~StyleGenericContent();
22522 new (this) StyleGenericContent(other);
22523 }
22524 return *this;
22525 }
22526};
22527
22528/// A computed value for the `content` property.
22529using StyleContent = StyleGenericContent<StyleImage>;
22530
22531/// A computed content item.
22532using StyleContentItem = StyleGenericContentItem<StyleImage>;
22533
22534/// Constants shared by multiple CSS Box Alignment properties
22535struct StyleAlignFlags {
22536 uint8_t _0;
22537
22538 constexpr explicit operator bool() const {
22539 return !!_0;
22540 }
22541 constexpr StyleAlignFlags operator~() const {
22542 return StyleAlignFlags { static_cast<decltype(_0)>(~_0) };
22543 }
22544 constexpr StyleAlignFlags operator|(const StyleAlignFlags& other) const {
22545 return StyleAlignFlags { static_cast<decltype(_0)>(this->_0 | other._0) };
22546 }
22547 StyleAlignFlags& operator|=(const StyleAlignFlags& other) {
22548 *this = (*this | other);
22549 return *this;
22550 }
22551 constexpr StyleAlignFlags operator&(const StyleAlignFlags& other) const {
22552 return StyleAlignFlags { static_cast<decltype(_0)>(this->_0 & other._0) };
22553 }
22554 StyleAlignFlags& operator&=(const StyleAlignFlags& other) {
22555 *this = (*this & other);
22556 return *this;
22557 }
22558 constexpr StyleAlignFlags operator^(const StyleAlignFlags& other) const {
22559 return StyleAlignFlags { static_cast<decltype(_0)>(this->_0 ^ other._0) };
22560 }
22561 StyleAlignFlags& operator^=(const StyleAlignFlags& other) {
22562 *this = (*this ^ other);
22563 return *this;
22564 }
22565 bool operator==(const StyleAlignFlags& other) const {
22566 return _0 == other._0;
22567 }
22568 bool operator!=(const StyleAlignFlags& other) const {
22569 return _0 != other._0;
22570 }
22571 static const StyleAlignFlags AUTO;
22572 static const StyleAlignFlags NORMAL;
22573 static const StyleAlignFlags START;
22574 static const StyleAlignFlags END;
22575 static const StyleAlignFlags FLEX_START;
22576 static const StyleAlignFlags FLEX_END;
22577 static const StyleAlignFlags CENTER;
22578 static const StyleAlignFlags LEFT;
22579 static const StyleAlignFlags RIGHT;
22580 static const StyleAlignFlags BASELINE;
22581 static const StyleAlignFlags LAST_BASELINE;
22582 static const StyleAlignFlags STRETCH;
22583 static const StyleAlignFlags SELF_START;
22584 static const StyleAlignFlags SELF_END;
22585 static const StyleAlignFlags SPACE_BETWEEN;
22586 static const StyleAlignFlags SPACE_AROUND;
22587 static const StyleAlignFlags SPACE_EVENLY;
22588 static const StyleAlignFlags ANCHOR_CENTER;
22589 static const StyleAlignFlags LEGACY;
22590 static const StyleAlignFlags SAFE;
22591 static const StyleAlignFlags UNSAFE;
22592 static const StyleAlignFlags FLAG_BITS;
22593};
22594/// {align,justify}-{content,items,self}: 'auto'
22595constexpr inline const StyleAlignFlags StyleAlignFlags::AUTO = StyleAlignFlags{ /* ._0 = */ (uint8_t)0 };
22596/// 'normal'
22597constexpr inline const StyleAlignFlags StyleAlignFlags::NORMAL = StyleAlignFlags{ /* ._0 = */ (uint8_t)1 };
22598/// 'start'
22599constexpr inline const StyleAlignFlags StyleAlignFlags::START = StyleAlignFlags{ /* ._0 = */ (uint8_t)2 };
22600/// 'end'
22601constexpr inline const StyleAlignFlags StyleAlignFlags::END = StyleAlignFlags{ /* ._0 = */ (uint8_t)3 };
22602/// 'flex-start'
22603constexpr inline const StyleAlignFlags StyleAlignFlags::FLEX_START = StyleAlignFlags{ /* ._0 = */ (uint8_t)4 };
22604/// 'flex-end'
22605constexpr inline const StyleAlignFlags StyleAlignFlags::FLEX_END = StyleAlignFlags{ /* ._0 = */ (uint8_t)5 };
22606/// 'center'
22607constexpr inline const StyleAlignFlags StyleAlignFlags::CENTER = StyleAlignFlags{ /* ._0 = */ (uint8_t)6 };
22608/// 'left'
22609constexpr inline const StyleAlignFlags StyleAlignFlags::LEFT = StyleAlignFlags{ /* ._0 = */ (uint8_t)7 };
22610/// 'right'
22611constexpr inline const StyleAlignFlags StyleAlignFlags::RIGHT = StyleAlignFlags{ /* ._0 = */ (uint8_t)8 };
22612/// 'baseline'
22613constexpr inline const StyleAlignFlags StyleAlignFlags::BASELINE = StyleAlignFlags{ /* ._0 = */ (uint8_t)9 };
22614/// 'last-baseline'
22615constexpr inline const StyleAlignFlags StyleAlignFlags::LAST_BASELINE = StyleAlignFlags{ /* ._0 = */ (uint8_t)10 };
22616/// 'stretch'
22617constexpr inline const StyleAlignFlags StyleAlignFlags::STRETCH = StyleAlignFlags{ /* ._0 = */ (uint8_t)11 };
22618/// 'self-start'
22619constexpr inline const StyleAlignFlags StyleAlignFlags::SELF_START = StyleAlignFlags{ /* ._0 = */ (uint8_t)12 };
22620/// 'self-end'
22621constexpr inline const StyleAlignFlags StyleAlignFlags::SELF_END = StyleAlignFlags{ /* ._0 = */ (uint8_t)13 };
22622/// 'space-between'
22623constexpr inline const StyleAlignFlags StyleAlignFlags::SPACE_BETWEEN = StyleAlignFlags{ /* ._0 = */ (uint8_t)14 };
22624/// 'space-around'
22625constexpr inline const StyleAlignFlags StyleAlignFlags::SPACE_AROUND = StyleAlignFlags{ /* ._0 = */ (uint8_t)15 };
22626/// 'space-evenly'
22627constexpr inline const StyleAlignFlags StyleAlignFlags::SPACE_EVENLY = StyleAlignFlags{ /* ._0 = */ (uint8_t)16 };
22628/// `anchor-center`
22629constexpr inline const StyleAlignFlags StyleAlignFlags::ANCHOR_CENTER = StyleAlignFlags{ /* ._0 = */ (uint8_t)17 };
22630/// 'legacy' (mutually exclusive w. SAFE & UNSAFE)
22631constexpr inline const StyleAlignFlags StyleAlignFlags::LEGACY = StyleAlignFlags{ /* ._0 = */ (uint8_t)(1 << 5) };
22632/// 'safe'
22633constexpr inline const StyleAlignFlags StyleAlignFlags::SAFE = StyleAlignFlags{ /* ._0 = */ (uint8_t)(1 << 6) };
22634/// 'unsafe' (mutually exclusive w. SAFE)
22635constexpr inline const StyleAlignFlags StyleAlignFlags::UNSAFE = StyleAlignFlags{ /* ._0 = */ (uint8_t)(1 << 7) };
22636/// Mask for the additional flags above.
22637constexpr inline const StyleAlignFlags StyleAlignFlags::FLAG_BITS = StyleAlignFlags{ /* ._0 = */ (uint8_t)224 };
22638
22639/// <https://drafts.csswg.org/css-align/#self-alignment>
22640using StyleSelfAlignment = StyleAlignFlags;
22641
22642/// The specified value of the align-self property.
22643///
22644/// <https://drafts.csswg.org/css-align/#propdef-align-self>
22645struct StyleAlignSelf {
22646 StyleSelfAlignment _0;
22647
22648 bool operator==(const StyleAlignSelf& other) const {
22649 return _0 == other._0;
22650 }
22651 bool operator!=(const StyleAlignSelf& other) const {
22652 return _0 != other._0;
22653 }
22654};
22655
22656/// The specified value of the justify-self property.
22657///
22658/// <https://drafts.csswg.org/css-align/#propdef-justify-self>
22659struct StyleJustifySelf {
22660 StyleSelfAlignment _0;
22661
22662 bool operator==(const StyleJustifySelf& other) const {
22663 return _0 == other._0;
22664 }
22665 bool operator!=(const StyleJustifySelf& other) const {
22666 return _0 != other._0;
22667 }
22668};
22669
22670/// Value of the `align-items` property
22671///
22672/// <https://drafts.csswg.org/css-align/#propdef-align-items>
22673struct StyleAlignItems {
22674 StyleAlignFlags _0;
22675
22676 bool operator==(const StyleAlignItems& other) const {
22677 return _0 == other._0;
22678 }
22679 bool operator!=(const StyleAlignItems& other) const {
22680 return _0 != other._0;
22681 }
22682};
22683
22684/// Value of the `justify-items` property
22685///
22686/// <https://drafts.csswg.org/css-align/#justify-items-property>
22687struct StyleJustifyItems {
22688 StyleAlignFlags _0;
22689
22690 bool operator==(const StyleJustifyItems& other) const {
22691 return _0 == other._0;
22692 }
22693 bool operator!=(const StyleJustifyItems& other) const {
22694 return _0 != other._0;
22695 }
22696};
22697
22698/// The computed value for the `justify-items` property.
22699///
22700/// Need to carry around both the specified and computed value to handle the
22701/// special legacy keyword without destroying style sharing.
22702///
22703/// In particular, `justify-items` is a reset property, so we ought to be able
22704/// to share its computed representation across elements as long as they match
22705/// the same rules. Except that it's not true if the specified value for
22706/// `justify-items` is `legacy` and the computed value of the parent has the
22707/// `legacy` modifier.
22708///
22709/// So instead of computing `legacy` "normally" looking at get_parent_position(),
22710/// marking it as uncacheable, we carry the specified value around and handle
22711/// the special case in `StyleAdjuster` instead, only when the result of the
22712/// computation would vary.
22713///
22714/// Note that we also need to special-case this property in matching.rs, in
22715/// order to properly handle changes to the legacy keyword... This all kinda
22716/// sucks :(.
22717///
22718/// See the discussion in https://bugzil.la/1384542.
22719struct StyleComputedJustifyItems {
22720 /// The specified value for the property. Can contain the bare `legacy`
22721 /// keyword.
22722 StyleJustifyItems specified;
22723 /// The computed value for the property. Cannot contain the bare `legacy`
22724 /// keyword, but note that it could contain it in combination with other
22725 /// keywords like `left`, `right` or `center`.
22726 StyleJustifyItems computed;
22727
22728 bool operator==(const StyleComputedJustifyItems& other) const {
22729 return specified == other.specified &&
22730 computed == other.computed;
22731 }
22732 bool operator!=(const StyleComputedJustifyItems& other) const {
22733 return specified != other.specified ||
22734 computed != other.computed;
22735 }
22736};
22737
22738/// Shared value for the `align-content` and `justify-content` properties.
22739///
22740/// <https://drafts.csswg.org/css-align/#content-distribution>
22741struct StyleContentDistribution {
22742 StyleAlignFlags primary;
22743
22744 bool operator==(const StyleContentDistribution& other) const {
22745 return primary == other.primary;
22746 }
22747 bool operator!=(const StyleContentDistribution& other) const {
22748 return primary != other.primary;
22749 }
22750};
22751
22752/// Value for the `align-content` property.
22753///
22754/// <https://drafts.csswg.org/css-align/#propdef-align-content>
22755using StyleAlignContent = StyleContentDistribution;
22756
22757/// Value for the `justify-content` property.
22758///
22759/// <https://drafts.csswg.org/css-align/#propdef-justify-content>
22760using StyleJustifyContent = StyleContentDistribution;
22761
22762/// <https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box>
22763union StyleShapeGeometryBox {
22764 enum class Tag : uint8_t {
22765 /// Depending on which kind of element this style value applied on, the
22766 /// default value of the reference-box can be different. For an HTML
22767 /// element, the default value of reference-box is border-box; for an SVG
22768 /// element, the default value is fill-box. Since we can not determine the
22769 /// default value at parsing time, we keep this value to make a decision on
22770 /// it.
22771 ElementDependent,
22772 FillBox,
22773 StrokeBox,
22774 ViewBox,
22775 ShapeBox,
22776 };
22777
22778 struct ShapeBox_Body {
22779 Tag tag;
22780 StyleShapeBox _0;
22781
22782 bool operator==(const ShapeBox_Body& other) const {
22783 return _0 == other._0;
22784 }
22785 bool operator!=(const ShapeBox_Body& other) const {
22786 return _0 != other._0;
22787 }
22788 };
22789
22790 struct {
22791 Tag tag;
22792 };
22793 ShapeBox_Body shape_box;
22794
22795 static StyleShapeGeometryBox ElementDependent() {
22796 StyleShapeGeometryBox result;
22797 result.tag = Tag::ElementDependent;
22798 return result;
22799 }
22800
22801 bool IsElementDependent() const {
22802 return tag == Tag::ElementDependent;
22803 }
22804
22805 static StyleShapeGeometryBox FillBox() {
22806 StyleShapeGeometryBox result;
22807 result.tag = Tag::FillBox;
22808 return result;
22809 }
22810
22811 bool IsFillBox() const {
22812 return tag == Tag::FillBox;
22813 }
22814
22815 static StyleShapeGeometryBox StrokeBox() {
22816 StyleShapeGeometryBox result;
22817 result.tag = Tag::StrokeBox;
22818 return result;
22819 }
22820
22821 bool IsStrokeBox() const {
22822 return tag == Tag::StrokeBox;
22823 }
22824
22825 static StyleShapeGeometryBox ViewBox() {
22826 StyleShapeGeometryBox result;
22827 result.tag = Tag::ViewBox;
22828 return result;
22829 }
22830
22831 bool IsViewBox() const {
22832 return tag == Tag::ViewBox;
22833 }
22834
22835 static StyleShapeGeometryBox ShapeBox(const StyleShapeBox &_0) {
22836 StyleShapeGeometryBox result;
22837 ::new (&result.shape_box._0) (StyleShapeBox)(_0);
22838 result.tag = Tag::ShapeBox;
22839 return result;
22840 }
22841
22842 bool IsShapeBox() const {
22843 return tag == Tag::ShapeBox;
22844 }
22845
22846 const StyleShapeBox& AsShapeBox() const {
22847 MOZ_DIAGNOSTIC_ASSERT(IsShapeBox())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsShapeBox())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsShapeBox()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsShapeBox()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 22847); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsShapeBox()"
")"); do { *((volatile int*)__null) = 22847; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
22848 return shape_box._0;
22849 }
22850
22851 bool operator==(const StyleShapeGeometryBox& other) const {
22852 if (tag != other.tag) {
22853 return false;
22854 }
22855 switch (tag) {
22856 case Tag::ShapeBox: return shape_box == other.shape_box;
22857 default: break;
22858 }
22859 return true;
22860 }
22861
22862 bool operator!=(const StyleShapeGeometryBox& other) const {
22863 return !(*this == other);
22864 }
22865
22866 private:
22867 StyleShapeGeometryBox() {
22868
22869 }
22870 public:
22871
22872
22873 ~StyleShapeGeometryBox() {
22874 switch (tag) {
22875 case Tag::ShapeBox: shape_box.~ShapeBox_Body(); break;
22876 default: break;
22877 }
22878 }
22879
22880 StyleShapeGeometryBox(const StyleShapeGeometryBox& other)
22881 : tag(other.tag) {
22882 switch (tag) {
22883 case Tag::ShapeBox: ::new (&shape_box) (ShapeBox_Body)(other.shape_box); break;
22884 default: break;
22885 }
22886 }
22887 StyleShapeGeometryBox& operator=(const StyleShapeGeometryBox& other) {
22888 if (this != &other) {
22889 this->~StyleShapeGeometryBox();
22890 new (this) StyleShapeGeometryBox(other);
22891 }
22892 return *this;
22893 }
22894};
22895
22896/// A value for the `clip-path` property.
22897template<typename BasicShape, typename U>
22898union StyleGenericClipPath {
22899 enum class Tag : uint8_t {
22900 None,
22901 Url,
22902 Shape,
22903 Box,
22904 };
22905
22906 struct Url_Body {
22907 Tag tag;
22908 U _0;
22909
22910 bool operator==(const Url_Body& other) const {
22911 return _0 == other._0;
22912 }
22913 bool operator!=(const Url_Body& other) const {
22914 return _0 != other._0;
22915 }
22916 };
22917
22918 struct Shape_Body {
22919 Tag tag;
22920 StyleBox<BasicShape> _0;
22921 StyleShapeGeometryBox _1;
22922
22923 bool operator==(const Shape_Body& other) const {
22924 return _0 == other._0 &&
22925 _1 == other._1;
22926 }
22927 bool operator!=(const Shape_Body& other) const {
22928 return _0 != other._0 ||
22929 _1 != other._1;
22930 }
22931 };
22932
22933 struct Box_Body {
22934 Tag tag;
22935 StyleShapeGeometryBox _0;
22936
22937 bool operator==(const Box_Body& other) const {
22938 return _0 == other._0;
22939 }
22940 bool operator!=(const Box_Body& other) const {
22941 return _0 != other._0;
22942 }
22943 };
22944
22945 struct {
22946 Tag tag;
22947 };
22948 Url_Body url;
22949 Shape_Body shape;
22950 Box_Body box;
22951
22952 static StyleGenericClipPath None() {
22953 StyleGenericClipPath result;
22954 result.tag = Tag::None;
22955 return result;
22956 }
22957
22958 bool IsNone() const {
22959 return tag == Tag::None;
22960 }
22961
22962 static StyleGenericClipPath Url(const U &_0) {
22963 StyleGenericClipPath result;
22964 ::new (&result.url._0) (U)(_0);
22965 result.tag = Tag::Url;
22966 return result;
22967 }
22968
22969 bool IsUrl() const {
22970 return tag == Tag::Url;
22971 }
22972
22973 const U& AsUrl() const {
22974 MOZ_DIAGNOSTIC_ASSERT(IsUrl())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsUrl())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsUrl()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsUrl()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 22974); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsUrl()"
")"); do { *((volatile int*)__null) = 22974; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
22975 return url._0;
22976 }
22977
22978 static StyleGenericClipPath Shape(const StyleBox<BasicShape> &_0,
22979 const StyleShapeGeometryBox &_1) {
22980 StyleGenericClipPath result;
22981 ::new (&result.shape._0) (StyleBox<BasicShape>)(_0);
22982 ::new (&result.shape._1) (StyleShapeGeometryBox)(_1);
22983 result.tag = Tag::Shape;
22984 return result;
22985 }
22986
22987 bool IsShape() const {
22988 return tag == Tag::Shape;
22989 }
22990
22991 const Shape_Body& AsShape() const {
22992 MOZ_DIAGNOSTIC_ASSERT(IsShape())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsShape())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsShape()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsShape()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 22992); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsShape()"
")"); do { *((volatile int*)__null) = 22992; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
22993 return shape;
22994 }
22995
22996 static StyleGenericClipPath Box(const StyleShapeGeometryBox &_0) {
22997 StyleGenericClipPath result;
22998 ::new (&result.box._0) (StyleShapeGeometryBox)(_0);
22999 result.tag = Tag::Box;
23000 return result;
23001 }
23002
23003 bool IsBox() const {
23004 return tag == Tag::Box;
23005 }
23006
23007 const StyleShapeGeometryBox& AsBox() const {
23008 MOZ_DIAGNOSTIC_ASSERT(IsBox())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsBox())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsBox()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsBox()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 23008); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsBox()"
")"); do { *((volatile int*)__null) = 23008; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
23009 return box._0;
23010 }
23011
23012 bool operator==(const StyleGenericClipPath& other) const {
23013 if (tag != other.tag) {
23014 return false;
23015 }
23016 switch (tag) {
23017 case Tag::Url: return url == other.url;
23018 case Tag::Shape: return shape == other.shape;
23019 case Tag::Box: return box == other.box;
23020 default: break;
23021 }
23022 return true;
23023 }
23024
23025 bool operator!=(const StyleGenericClipPath& other) const {
23026 return !(*this == other);
23027 }
23028
23029 private:
23030 StyleGenericClipPath() {
23031
23032 }
23033 public:
23034
23035
23036 ~StyleGenericClipPath() {
23037 switch (tag) {
23038 case Tag::Url: url.~Url_Body(); break;
23039 case Tag::Shape: shape.~Shape_Body(); break;
23040 case Tag::Box: box.~Box_Body(); break;
23041 default: break;
23042 }
23043 }
23044
23045 StyleGenericClipPath(const StyleGenericClipPath& other)
23046 : tag(other.tag) {
23047 switch (tag) {
23048 case Tag::Url: ::new (&url) (Url_Body)(other.url); break;
23049 case Tag::Shape: ::new (&shape) (Shape_Body)(other.shape); break;
23050 case Tag::Box: ::new (&box) (Box_Body)(other.box); break;
23051 default: break;
23052 }
23053 }
23054 StyleGenericClipPath& operator=(const StyleGenericClipPath& other) {
23055 if (this != &other) {
23056 this->~StyleGenericClipPath();
23057 new (this) StyleGenericClipPath(other);
23058 }
23059 return *this;
23060 }
23061};
23062
23063/// A computed `clip-path` value.
23064using StyleClipPath = StyleGenericClipPath<StyleBasicShape, StyleComputedUrl>;
23065
23066/// A value for the `shape-outside` property.
23067template<typename BasicShape, typename I>
23068union StyleGenericShapeOutside {
23069 enum class Tag : uint8_t {
23070 None,
23071 Image,
23072 Shape,
23073 Box,
23074 };
23075
23076 struct Image_Body {
23077 Tag tag;
23078 I _0;
23079
23080 bool operator==(const Image_Body& other) const {
23081 return _0 == other._0;
23082 }
23083 bool operator!=(const Image_Body& other) const {
23084 return _0 != other._0;
23085 }
23086 };
23087
23088 struct Shape_Body {
23089 Tag tag;
23090 StyleBox<BasicShape> _0;
23091 StyleShapeBox _1;
23092
23093 bool operator==(const Shape_Body& other) const {
23094 return _0 == other._0 &&
23095 _1 == other._1;
23096 }
23097 bool operator!=(const Shape_Body& other) const {
23098 return _0 != other._0 ||
23099 _1 != other._1;
23100 }
23101 };
23102
23103 struct Box_Body {
23104 Tag tag;
23105 StyleShapeBox _0;
23106
23107 bool operator==(const Box_Body& other) const {
23108 return _0 == other._0;
23109 }
23110 bool operator!=(const Box_Body& other) const {
23111 return _0 != other._0;
23112 }
23113 };
23114
23115 struct {
23116 Tag tag;
23117 };
23118 Image_Body image;
23119 Shape_Body shape;
23120 Box_Body box;
23121
23122 static StyleGenericShapeOutside None() {
23123 StyleGenericShapeOutside result;
23124 result.tag = Tag::None;
23125 return result;
23126 }
23127
23128 bool IsNone() const {
23129 return tag == Tag::None;
23130 }
23131
23132 static StyleGenericShapeOutside Image(const I &_0) {
23133 StyleGenericShapeOutside result;
23134 ::new (&result.image._0) (I)(_0);
23135 result.tag = Tag::Image;
23136 return result;
23137 }
23138
23139 bool IsImage() const {
23140 return tag == Tag::Image;
23141 }
23142
23143 const I& AsImage() const {
23144 MOZ_DIAGNOSTIC_ASSERT(IsImage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsImage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsImage()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsImage()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 23144); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsImage()"
")"); do { *((volatile int*)__null) = 23144; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
23145 return image._0;
23146 }
23147
23148 static StyleGenericShapeOutside Shape(const StyleBox<BasicShape> &_0,
23149 const StyleShapeBox &_1) {
23150 StyleGenericShapeOutside result;
23151 ::new (&result.shape._0) (StyleBox<BasicShape>)(_0);
23152 ::new (&result.shape._1) (StyleShapeBox)(_1);
23153 result.tag = Tag::Shape;
23154 return result;
23155 }
23156
23157 bool IsShape() const {
23158 return tag == Tag::Shape;
23159 }
23160
23161 const Shape_Body& AsShape() const {
23162 MOZ_DIAGNOSTIC_ASSERT(IsShape())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsShape())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsShape()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsShape()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 23162); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsShape()"
")"); do { *((volatile int*)__null) = 23162; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
23163 return shape;
23164 }
23165
23166 static StyleGenericShapeOutside Box(const StyleShapeBox &_0) {
23167 StyleGenericShapeOutside result;
23168 ::new (&result.box._0) (StyleShapeBox)(_0);
23169 result.tag = Tag::Box;
23170 return result;
23171 }
23172
23173 bool IsBox() const {
23174 return tag == Tag::Box;
23175 }
23176
23177 const StyleShapeBox& AsBox() const {
23178 MOZ_DIAGNOSTIC_ASSERT(IsBox())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsBox())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsBox()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsBox()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 23178); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsBox()"
")"); do { *((volatile int*)__null) = 23178; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
23179 return box._0;
23180 }
23181
23182 bool operator==(const StyleGenericShapeOutside& other) const {
23183 if (tag != other.tag) {
23184 return false;
23185 }
23186 switch (tag) {
23187 case Tag::Image: return image == other.image;
23188 case Tag::Shape: return shape == other.shape;
23189 case Tag::Box: return box == other.box;
23190 default: break;
23191 }
23192 return true;
23193 }
23194
23195 bool operator!=(const StyleGenericShapeOutside& other) const {
23196 return !(*this == other);
23197 }
23198
23199 private:
23200 StyleGenericShapeOutside() {
23201
23202 }
23203 public:
23204
23205
23206 ~StyleGenericShapeOutside() {
23207 switch (tag) {
23208 case Tag::Image: image.~Image_Body(); break;
23209 case Tag::Shape: shape.~Shape_Body(); break;
23210 case Tag::Box: box.~Box_Body(); break;
23211 default: break;
23212 }
23213 }
23214
23215 StyleGenericShapeOutside(const StyleGenericShapeOutside& other)
23216 : tag(other.tag) {
23217 switch (tag) {
23218 case Tag::Image: ::new (&image) (Image_Body)(other.image); break;
23219 case Tag::Shape: ::new (&shape) (Shape_Body)(other.shape); break;
23220 case Tag::Box: ::new (&box) (Box_Body)(other.box); break;
23221 default: break;
23222 }
23223 }
23224 StyleGenericShapeOutside& operator=(const StyleGenericShapeOutside& other) {
23225 if (this != &other) {
23226 this->~StyleGenericShapeOutside();
23227 new (this) StyleGenericShapeOutside(other);
23228 }
23229 return *this;
23230 }
23231};
23232
23233/// A computed `shape-outside` value.
23234using StyleShapeOutside = StyleGenericShapeOutside<StyleBasicShape, StyleImage>;
23235
23236/// Controls how the auto-placement algorithm works specifying exactly how auto-placed items
23237/// get flowed into the grid: [ row | column ] || dense
23238/// https://drafts.csswg.org/css-grid-2/#grid-auto-flow-property
23239struct StyleGridAutoFlow {
23240 uint8_t _0;
23241
23242 constexpr explicit operator bool() const {
23243 return !!_0;
23244 }
23245 constexpr StyleGridAutoFlow operator~() const {
23246 return StyleGridAutoFlow { static_cast<decltype(_0)>(~_0) };
23247 }
23248 constexpr StyleGridAutoFlow operator|(const StyleGridAutoFlow& other) const {
23249 return StyleGridAutoFlow { static_cast<decltype(_0)>(this->_0 | other._0) };
23250 }
23251 StyleGridAutoFlow& operator|=(const StyleGridAutoFlow& other) {
23252 *this = (*this | other);
23253 return *this;
23254 }
23255 constexpr StyleGridAutoFlow operator&(const StyleGridAutoFlow& other) const {
23256 return StyleGridAutoFlow { static_cast<decltype(_0)>(this->_0 & other._0) };
23257 }
23258 StyleGridAutoFlow& operator&=(const StyleGridAutoFlow& other) {
23259 *this = (*this & other);
23260 return *this;
23261 }
23262 constexpr StyleGridAutoFlow operator^(const StyleGridAutoFlow& other) const {
23263 return StyleGridAutoFlow { static_cast<decltype(_0)>(this->_0 ^ other._0) };
23264 }
23265 StyleGridAutoFlow& operator^=(const StyleGridAutoFlow& other) {
23266 *this = (*this ^ other);
23267 return *this;
23268 }
23269 bool operator==(const StyleGridAutoFlow& other) const {
23270 return _0 == other._0;
23271 }
23272 bool operator!=(const StyleGridAutoFlow& other) const {
23273 return _0 != other._0;
23274 }
23275 static const StyleGridAutoFlow ROW;
23276 static const StyleGridAutoFlow COLUMN;
23277 static const StyleGridAutoFlow DENSE;
23278};
23279/// 'row' - mutually exclusive with 'column'
23280constexpr inline const StyleGridAutoFlow StyleGridAutoFlow::ROW = StyleGridAutoFlow{ /* ._0 = */ (uint8_t)(1 << 0) };
23281/// 'column' - mutually exclusive with 'row'
23282constexpr inline const StyleGridAutoFlow StyleGridAutoFlow::COLUMN = StyleGridAutoFlow{ /* ._0 = */ (uint8_t)(1 << 1) };
23283/// 'dense'
23284constexpr inline const StyleGridAutoFlow StyleGridAutoFlow::DENSE = StyleGridAutoFlow{ /* ._0 = */ (uint8_t)(1 << 2) };
23285
23286/// A generic value for item of `image cursors`.
23287template<typename Image, typename Number>
23288struct StyleGenericCursorImage {
23289 /// The url to parse images from.
23290 Image image;
23291 /// Whether the image has a hotspot or not.
23292 bool has_hotspot;
23293 /// The x coordinate.
23294 Number hotspot_x;
23295 /// The y coordinate.
23296 Number hotspot_y;
23297
23298 bool operator==(const StyleGenericCursorImage& other) const {
23299 return image == other.image &&
23300 has_hotspot == other.has_hotspot &&
23301 hotspot_x == other.hotspot_x &&
23302 hotspot_y == other.hotspot_y;
23303 }
23304 bool operator!=(const StyleGenericCursorImage& other) const {
23305 return image != other.image ||
23306 has_hotspot != other.has_hotspot ||
23307 hotspot_x != other.hotspot_x ||
23308 hotspot_y != other.hotspot_y;
23309 }
23310};
23311
23312/// A computed value for item of `image cursors`.
23313using StyleCursorImage = StyleGenericCursorImage<StyleImage, StyleNumber>;
23314
23315/// A generic value for the `cursor` property.
23316///
23317/// https://drafts.csswg.org/css-ui/#cursor
23318template<typename Image>
23319struct StyleGenericCursor {
23320 /// The parsed images for the cursor.
23321 StyleOwnedSlice<Image> images;
23322 /// The kind of the cursor [default | help | ...].
23323 StyleCursorKind keyword;
23324
23325 bool operator==(const StyleGenericCursor& other) const {
23326 return images == other.images &&
23327 keyword == other.keyword;
23328 }
23329 bool operator!=(const StyleGenericCursor& other) const {
23330 return images != other.images ||
23331 keyword != other.keyword;
23332 }
23333};
23334
23335/// A computed value for the `cursor` property.
23336using StyleCursor = StyleGenericCursor<StyleCursorImage>;
23337
23338/// Generic value for stroke-dasharray.
23339template<typename L>
23340struct StyleGenericSVGStrokeDashArray {
23341 enum class Tag : uint8_t {
23342 /// `[ <length> | <percentage> | <number> ]#`
23343 Values,
23344 /// `context-value`
23345 ContextValue,
23346 };
23347
23348 struct StyleValues_Body {
23349 StyleOwnedSlice<L> _0;
23350
23351 bool operator==(const StyleValues_Body& other) const {
23352 return _0 == other._0;
23353 }
23354 bool operator!=(const StyleValues_Body& other) const {
23355 return _0 != other._0;
23356 }
23357 };
23358
23359 Tag tag;
23360 union {
23361 StyleValues_Body values;
23362 };
23363
23364 static StyleGenericSVGStrokeDashArray Values(const StyleOwnedSlice<L> &_0) {
23365 StyleGenericSVGStrokeDashArray result;
23366 ::new (&result.values._0) (StyleOwnedSlice<L>)(_0);
23367 result.tag = Tag::Values;
23368 return result;
23369 }
23370
23371 bool IsValues() const {
23372 return tag == Tag::Values;
23373 }
23374
23375 const StyleOwnedSlice<L>& AsValues() const {
23376 MOZ_DIAGNOSTIC_ASSERT(IsValues())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsValues())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsValues()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsValues()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 23376); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsValues()"
")"); do { *((volatile int*)__null) = 23376; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
23377 return values._0;
23378 }
23379
23380 static StyleGenericSVGStrokeDashArray ContextValue() {
23381 StyleGenericSVGStrokeDashArray result;
23382 result.tag = Tag::ContextValue;
23383 return result;
23384 }
23385
23386 bool IsContextValue() const {
23387 return tag == Tag::ContextValue;
23388 }
23389
23390 bool operator==(const StyleGenericSVGStrokeDashArray& other) const {
23391 if (tag != other.tag) {
23392 return false;
23393 }
23394 switch (tag) {
23395 case Tag::Values: return values == other.values;
23396 default: break;
23397 }
23398 return true;
23399 }
23400
23401 bool operator!=(const StyleGenericSVGStrokeDashArray& other) const {
23402 return !(*this == other);
23403 }
23404
23405 private:
23406 StyleGenericSVGStrokeDashArray() {
23407
23408 }
23409 public:
23410
23411
23412 ~StyleGenericSVGStrokeDashArray() {
23413 switch (tag) {
23414 case Tag::Values: values.~StyleValues_Body(); break;
23415 default: break;
23416 }
23417 }
23418
23419 StyleGenericSVGStrokeDashArray(const StyleGenericSVGStrokeDashArray& other)
23420 : tag(other.tag) {
23421 switch (tag) {
23422 case Tag::Values: ::new (&values) (StyleValues_Body)(other.values); break;
23423 default: break;
23424 }
23425 }
23426 StyleGenericSVGStrokeDashArray& operator=(const StyleGenericSVGStrokeDashArray& other) {
23427 if (this != &other) {
23428 this->~StyleGenericSVGStrokeDashArray();
23429 new (this) StyleGenericSVGStrokeDashArray(other);
23430 }
23431 return *this;
23432 }
23433};
23434
23435/// [ <length> | <percentage> | <number> ]# | context-value
23436using StyleSVGStrokeDashArray = StyleGenericSVGStrokeDashArray<StyleNonNegativeLengthPercentage>;
23437
23438/// An SVG length value supports `context-value` in addition to length.
23439template<typename L>
23440struct StyleGenericSVGLength {
23441 enum class Tag : uint8_t {
23442 /// `<length> | <percentage> | <number>`
23443 LengthPercentage,
23444 /// `context-value`
23445 ContextValue,
23446 };
23447
23448 struct StyleLengthPercentage_Body {
23449 L _0;
23450
23451 bool operator==(const StyleLengthPercentage_Body& other) const {
23452 return _0 == other._0;
23453 }
23454 bool operator!=(const StyleLengthPercentage_Body& other) const {
23455 return _0 != other._0;
23456 }
23457 };
23458
23459 Tag tag;
23460 union {
23461 StyleLengthPercentage_Body length_percentage;
23462 };
23463
23464 static StyleGenericSVGLength LengthPercentage(const L &_0) {
23465 StyleGenericSVGLength result;
23466 ::new (&result.length_percentage._0) (L)(_0);
23467 result.tag = Tag::LengthPercentage;
23468 return result;
23469 }
23470
23471 bool IsLengthPercentage() const {
23472 return tag == Tag::LengthPercentage;
23473 }
23474
23475 const L& AsLengthPercentage() const {
23476 MOZ_DIAGNOSTIC_ASSERT(IsLengthPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLengthPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLengthPercentage()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsLengthPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 23476); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLengthPercentage()"
")"); do { *((volatile int*)__null) = 23476; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
23477 return length_percentage._0;
23478 }
23479
23480 static StyleGenericSVGLength ContextValue() {
23481 StyleGenericSVGLength result;
23482 result.tag = Tag::ContextValue;
23483 return result;
23484 }
23485
23486 bool IsContextValue() const {
23487 return tag == Tag::ContextValue;
23488 }
23489
23490 bool operator==(const StyleGenericSVGLength& other) const {
23491 if (tag != other.tag) {
23492 return false;
23493 }
23494 switch (tag) {
23495 case Tag::LengthPercentage: return length_percentage == other.length_percentage;
23496 default: break;
23497 }
23498 return true;
23499 }
23500
23501 bool operator!=(const StyleGenericSVGLength& other) const {
23502 return !(*this == other);
23503 }
23504
23505 private:
23506 StyleGenericSVGLength() {
23507
23508 }
23509 public:
23510
23511
23512 ~StyleGenericSVGLength() {
23513 switch (tag) {
23514 case Tag::LengthPercentage: length_percentage.~StyleLengthPercentage_Body(); break;
23515 default: break;
23516 }
23517 }
23518
23519 StyleGenericSVGLength(const StyleGenericSVGLength& other)
23520 : tag(other.tag) {
23521 switch (tag) {
23522 case Tag::LengthPercentage: ::new (&length_percentage) (StyleLengthPercentage_Body)(other.length_percentage); break;
23523 default: break;
23524 }
23525 }
23526 StyleGenericSVGLength& operator=(const StyleGenericSVGLength& other) {
23527 if (this != &other) {
23528 this->~StyleGenericSVGLength();
23529 new (this) StyleGenericSVGLength(other);
23530 }
23531 return *this;
23532 }
23533};
23534
23535/// <length> | <percentage> | <number> | context-value
23536using StyleSVGLength = StyleGenericSVGLength<StyleLengthPercentage>;
23537
23538/// A type used for opacity.
23539using StyleOpacity = StyleCSSFloat;
23540
23541/// An SVG opacity value accepts `context-{fill,stroke}-opacity` in
23542/// addition to opacity value.
23543template<typename OpacityType>
23544struct StyleGenericSVGOpacity {
23545 enum class Tag : uint8_t {
23546 /// `<opacity-value>`
23547 Opacity,
23548 /// `context-fill-opacity`
23549 ContextFillOpacity,
23550 /// `context-stroke-opacity`
23551 ContextStrokeOpacity,
23552 };
23553
23554 struct StyleOpacity_Body {
23555 OpacityType _0;
23556
23557 bool operator==(const StyleOpacity_Body& other) const {
23558 return _0 == other._0;
23559 }
23560 bool operator!=(const StyleOpacity_Body& other) const {
23561 return _0 != other._0;
23562 }
23563 };
23564
23565 Tag tag;
23566 union {
23567 StyleOpacity_Body opacity;
23568 };
23569
23570 static StyleGenericSVGOpacity Opacity(const OpacityType &_0) {
23571 StyleGenericSVGOpacity result;
23572 ::new (&result.opacity._0) (OpacityType)(_0);
23573 result.tag = Tag::Opacity;
23574 return result;
23575 }
23576
23577 bool IsOpacity() const {
23578 return tag == Tag::Opacity;
23579 }
23580
23581 const OpacityType& AsOpacity() const {
23582 MOZ_DIAGNOSTIC_ASSERT(IsOpacity())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsOpacity())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsOpacity()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsOpacity()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 23582); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsOpacity()"
")"); do { *((volatile int*)__null) = 23582; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
23583 return opacity._0;
23584 }
23585
23586 static StyleGenericSVGOpacity ContextFillOpacity() {
23587 StyleGenericSVGOpacity result;
23588 result.tag = Tag::ContextFillOpacity;
23589 return result;
23590 }
23591
23592 bool IsContextFillOpacity() const {
23593 return tag == Tag::ContextFillOpacity;
23594 }
23595
23596 static StyleGenericSVGOpacity ContextStrokeOpacity() {
23597 StyleGenericSVGOpacity result;
23598 result.tag = Tag::ContextStrokeOpacity;
23599 return result;
23600 }
23601
23602 bool IsContextStrokeOpacity() const {
23603 return tag == Tag::ContextStrokeOpacity;
23604 }
23605
23606 bool operator==(const StyleGenericSVGOpacity& other) const {
23607 if (tag != other.tag) {
23608 return false;
23609 }
23610 switch (tag) {
23611 case Tag::Opacity: return opacity == other.opacity;
23612 default: break;
23613 }
23614 return true;
23615 }
23616
23617 bool operator!=(const StyleGenericSVGOpacity& other) const {
23618 return !(*this == other);
23619 }
23620
23621 private:
23622 StyleGenericSVGOpacity() {
23623
23624 }
23625 public:
23626
23627
23628 ~StyleGenericSVGOpacity() {
23629 switch (tag) {
23630 case Tag::Opacity: opacity.~StyleOpacity_Body(); break;
23631 default: break;
23632 }
23633 }
23634
23635 StyleGenericSVGOpacity(const StyleGenericSVGOpacity& other)
23636 : tag(other.tag) {
23637 switch (tag) {
23638 case Tag::Opacity: ::new (&opacity) (StyleOpacity_Body)(other.opacity); break;
23639 default: break;
23640 }
23641 }
23642 StyleGenericSVGOpacity& operator=(const StyleGenericSVGOpacity& other) {
23643 if (this != &other) {
23644 this->~StyleGenericSVGOpacity();
23645 new (this) StyleGenericSVGOpacity(other);
23646 }
23647 return *this;
23648 }
23649};
23650
23651/// <opacity-value> | context-fill-opacity | context-stroke-opacity
23652using StyleSVGOpacity = StyleGenericSVGOpacity<StyleOpacity>;
23653
23654/// An non-negative wrapper of SVGLength.
23655using StyleSVGWidth = StyleGenericSVGLength<StyleNonNegativeLengthPercentage>;
23656
23657/// The computed value of `text-align`.
23658using StyleTextAlign = StyleTextAlignKeyword;
23659
23660/// A generic value for the `<ratio>` value.
23661template<typename N>
23662struct StyleRatio {
23663 N _0;
23664 N _1;
23665
23666 bool operator==(const StyleRatio& other) const {
23667 return _0 == other._0 &&
23668 _1 == other._1;
23669 }
23670 bool operator!=(const StyleRatio& other) const {
23671 return _0 != other._0 ||
23672 _1 != other._1;
23673 }
23674 inline AspectRatio ToLayoutRatio(UseBoxSizing aUseBoxSizing) const;
23675};
23676
23677/// Ratio or None.
23678template<typename N>
23679struct StylePreferredRatio {
23680 enum class Tag : uint8_t {
23681 /// Without specified ratio
23682 None,
23683 /// With specified ratio
23684 Ratio,
23685 };
23686
23687 struct StyleRatio_Body {
23688 StyleRatio<N> _0;
23689
23690 bool operator==(const StyleRatio_Body& other) const {
23691 return _0 == other._0;
23692 }
23693 bool operator!=(const StyleRatio_Body& other) const {
23694 return _0 != other._0;
23695 }
23696 };
23697
23698 Tag tag;
23699 union {
23700 StyleRatio_Body ratio;
23701 };
23702
23703 static StylePreferredRatio None() {
23704 StylePreferredRatio result;
23705 result.tag = Tag::None;
23706 return result;
23707 }
23708
23709 bool IsNone() const {
23710 return tag == Tag::None;
23711 }
23712
23713 static StylePreferredRatio Ratio(const StyleRatio<N> &_0) {
23714 StylePreferredRatio result;
23715 ::new (&result.ratio._0) (StyleRatio<N>)(_0);
23716 result.tag = Tag::Ratio;
23717 return result;
23718 }
23719
23720 bool IsRatio() const {
23721 return tag == Tag::Ratio;
23722 }
23723
23724 const StyleRatio<N>& AsRatio() const {
23725 MOZ_DIAGNOSTIC_ASSERT(IsRatio())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsRatio())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsRatio()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsRatio()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 23725); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsRatio()"
")"); do { *((volatile int*)__null) = 23725; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
23726 return ratio._0;
23727 }
23728
23729 bool operator==(const StylePreferredRatio& other) const {
23730 if (tag != other.tag) {
23731 return false;
23732 }
23733 switch (tag) {
23734 case Tag::Ratio: return ratio == other.ratio;
23735 default: break;
23736 }
23737 return true;
23738 }
23739
23740 bool operator!=(const StylePreferredRatio& other) const {
23741 return !(*this == other);
23742 }
23743
23744 private:
23745 StylePreferredRatio() {
23746
23747 }
23748 public:
23749
23750
23751 ~StylePreferredRatio() {
23752 switch (tag) {
23753 case Tag::Ratio: ratio.~StyleRatio_Body(); break;
23754 default: break;
23755 }
23756 }
23757
23758 StylePreferredRatio(const StylePreferredRatio& other)
23759 : tag(other.tag) {
23760 switch (tag) {
23761 case Tag::Ratio: ::new (&ratio) (StyleRatio_Body)(other.ratio); break;
23762 default: break;
23763 }
23764 }
23765 StylePreferredRatio& operator=(const StylePreferredRatio& other) {
23766 if (this != &other) {
23767 this->~StylePreferredRatio();
23768 new (this) StylePreferredRatio(other);
23769 }
23770 return *this;
23771 }
23772};
23773
23774/// A generic value for the `aspect-ratio` property, the value is `auto || <ratio>`.
23775template<typename N>
23776struct StyleGenericAspectRatio {
23777 /// Specifiy auto or not.
23778 bool auto_;
23779 /// The preferred aspect-ratio value.
23780 StylePreferredRatio<N> ratio;
23781
23782 bool operator==(const StyleGenericAspectRatio& other) const {
23783 return auto_ == other.auto_ &&
23784 ratio == other.ratio;
23785 }
23786 bool operator!=(const StyleGenericAspectRatio& other) const {
23787 return auto_ != other.auto_ ||
23788 ratio != other.ratio;
23789 }
23790 bool HasRatio() const { return ratio.IsRatio(); }
23791 bool HasFiniteRatio() const { return static_cast<bool>(ToLayoutRatio()); }
23792 bool BehavesAsAuto() const { return auto_ || !HasFiniteRatio(); }
23793 inline AspectRatio ToLayoutRatio() const;
23794
23795 static StyleGenericAspectRatio Auto() {
23796 return {true, StylePreferredRatio<N>::None()};
23797 }
23798};
23799
23800/// A computed value for the `aspect-ratio` property.
23801using StyleAspectRatio = StyleGenericAspectRatio<StyleNonNegativeNumber>;
23802
23803/// Page name value.
23804///
23805/// https://drafts.csswg.org/css-page-3/#using-named-pages
23806struct StylePageName {
23807 enum class Tag : uint8_t {
23808 /// `auto` value.
23809 Auto,
23810 /// Page name value
23811 PageName,
23812 };
23813
23814 struct StylePageName_Body {
23815 StyleCustomIdent _0;
23816
23817 bool operator==(const StylePageName_Body& other) const {
23818 return _0 == other._0;
23819 }
23820 bool operator!=(const StylePageName_Body& other) const {
23821 return _0 != other._0;
23822 }
23823 };
23824
23825 Tag tag;
23826 union {
23827 StylePageName_Body page_name;
23828 };
23829
23830 static StylePageName Auto() {
23831 StylePageName result;
23832 result.tag = Tag::Auto;
23833 return result;
23834 }
23835
23836 bool IsAuto() const {
23837 return tag == Tag::Auto;
23838 }
23839
23840 static StylePageName PageName(const StyleCustomIdent &_0) {
23841 StylePageName result;
23842 ::new (&result.page_name._0) (StyleCustomIdent)(_0);
23843 result.tag = Tag::PageName;
23844 return result;
23845 }
23846
23847 bool IsPageName() const {
23848 return tag == Tag::PageName;
23849 }
23850
23851 const StyleCustomIdent& AsPageName() const {
23852 MOZ_DIAGNOSTIC_ASSERT(IsPageName())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPageName())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPageName()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsPageName()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 23852); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPageName()"
")"); do { *((volatile int*)__null) = 23852; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
23853 return page_name._0;
23854 }
23855
23856 bool operator==(const StylePageName& other) const {
23857 if (tag != other.tag) {
23858 return false;
23859 }
23860 switch (tag) {
23861 case Tag::PageName: return page_name == other.page_name;
23862 default: break;
23863 }
23864 return true;
23865 }
23866
23867 bool operator!=(const StylePageName& other) const {
23868 return !(*this == other);
23869 }
23870
23871 private:
23872 StylePageName() {
23873
23874 }
23875 public:
23876
23877
23878 ~StylePageName() {
23879 switch (tag) {
23880 case Tag::PageName: page_name.~StylePageName_Body(); break;
23881 default: break;
23882 }
23883 }
23884
23885 StylePageName(const StylePageName& other)
23886 : tag(other.tag) {
23887 switch (tag) {
23888 case Tag::PageName: ::new (&page_name) (StylePageName_Body)(other.page_name); break;
23889 default: break;
23890 }
23891 }
23892 StylePageName& operator=(const StylePageName& other) {
23893 if (this != &other) {
23894 this->~StylePageName();
23895 new (this) StylePageName(other);
23896 }
23897 return *this;
23898 }
23899};
23900
23901/// Computed value of the @page size descriptor
23902///
23903/// The spec says that the computed value should be the same as the specified
23904/// value but with all absolute units, but it's not currently possibly observe
23905/// the computed value of page-size.
23906struct StylePageSize {
23907 enum class Tag : uint8_t {
23908 /// Specified size, paper size, or paper size and orientation.
23909 Size,
23910 /// `landscape` or `portrait` value, no specified size.
23911 Orientation,
23912 /// `auto` value
23913 Auto,
23914 };
23915
23916 struct StyleSize_Body {
23917 StyleSize2D<StyleNonNegativeLength> _0;
23918
23919 bool operator==(const StyleSize_Body& other) const {
23920 return _0 == other._0;
23921 }
23922 bool operator!=(const StyleSize_Body& other) const {
23923 return _0 != other._0;
23924 }
23925 };
23926
23927 struct StyleOrientation_Body {
23928 StylePageSizeOrientation _0;
23929
23930 bool operator==(const StyleOrientation_Body& other) const {
23931 return _0 == other._0;
23932 }
23933 bool operator!=(const StyleOrientation_Body& other) const {
23934 return _0 != other._0;
23935 }
23936 };
23937
23938 Tag tag;
23939 union {
23940 StyleSize_Body size;
23941 StyleOrientation_Body orientation;
23942 };
23943
23944 static StylePageSize Size(const StyleSize2D<StyleNonNegativeLength> &_0) {
23945 StylePageSize result;
23946 ::new (&result.size._0) (StyleSize2D<StyleNonNegativeLength>)(_0);
23947 result.tag = Tag::Size;
23948 return result;
23949 }
23950
23951 bool IsSize() const {
23952 return tag == Tag::Size;
23953 }
23954
23955 const StyleSize2D<StyleNonNegativeLength>& AsSize() const {
23956 MOZ_DIAGNOSTIC_ASSERT(IsSize())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsSize())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsSize()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsSize()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 23956); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsSize()"
")"); do { *((volatile int*)__null) = 23956; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
23957 return size._0;
23958 }
23959
23960 static StylePageSize Orientation(const StylePageSizeOrientation &_0) {
23961 StylePageSize result;
23962 ::new (&result.orientation._0) (StylePageSizeOrientation)(_0);
23963 result.tag = Tag::Orientation;
23964 return result;
23965 }
23966
23967 bool IsOrientation() const {
23968 return tag == Tag::Orientation;
23969 }
23970
23971 const StylePageSizeOrientation& AsOrientation() const {
23972 MOZ_DIAGNOSTIC_ASSERT(IsOrientation())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsOrientation())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsOrientation()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsOrientation()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 23972); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsOrientation()"
")"); do { *((volatile int*)__null) = 23972; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
23973 return orientation._0;
23974 }
23975
23976 static StylePageSize Auto() {
23977 StylePageSize result;
23978 result.tag = Tag::Auto;
23979 return result;
23980 }
23981
23982 bool IsAuto() const {
23983 return tag == Tag::Auto;
23984 }
23985
23986 bool operator==(const StylePageSize& other) const {
23987 if (tag != other.tag) {
23988 return false;
23989 }
23990 switch (tag) {
23991 case Tag::Size: return size == other.size;
23992 case Tag::Orientation: return orientation == other.orientation;
23993 default: break;
23994 }
23995 return true;
23996 }
23997
23998 bool operator!=(const StylePageSize& other) const {
23999 return !(*this == other);
24000 }
24001
24002 private:
24003 StylePageSize() {
24004
24005 }
24006 public:
24007
24008
24009 ~StylePageSize() {
24010 switch (tag) {
24011 case Tag::Size: size.~StyleSize_Body(); break;
24012 case Tag::Orientation: orientation.~StyleOrientation_Body(); break;
24013 default: break;
24014 }
24015 }
24016
24017 StylePageSize(const StylePageSize& other)
24018 : tag(other.tag) {
24019 switch (tag) {
24020 case Tag::Size: ::new (&size) (StyleSize_Body)(other.size); break;
24021 case Tag::Orientation: ::new (&orientation) (StyleOrientation_Body)(other.orientation); break;
24022 default: break;
24023 }
24024 }
24025 StylePageSize& operator=(const StylePageSize& other) {
24026 if (this != &other) {
24027 this->~StylePageSize();
24028 new (this) StylePageSize(other);
24029 }
24030 return *this;
24031 }
24032};
24033
24034/// The svg d property type.
24035///
24036/// https://svgwg.org/svg2-draft/paths.html#TheDProperty
24037struct StyleDProperty {
24038 enum class Tag : uint8_t {
24039 /// Path value for path(<string>) or just a <string>.
24040 Path,
24041 /// None value.
24042 None,
24043 };
24044
24045 struct StylePath_Body {
24046 StyleSVGPathData _0;
24047
24048 bool operator==(const StylePath_Body& other) const {
24049 return _0 == other._0;
24050 }
24051 bool operator!=(const StylePath_Body& other) const {
24052 return _0 != other._0;
24053 }
24054 };
24055
24056 Tag tag;
24057 union {
24058 StylePath_Body path;
24059 };
24060
24061 static StyleDProperty Path(const StyleSVGPathData &_0) {
24062 StyleDProperty result;
24063 ::new (&result.path._0) (StyleSVGPathData)(_0);
24064 result.tag = Tag::Path;
24065 return result;
24066 }
24067
24068 bool IsPath() const {
24069 return tag == Tag::Path;
24070 }
24071
24072 const StyleSVGPathData& AsPath() const {
24073 MOZ_DIAGNOSTIC_ASSERT(IsPath())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPath())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPath()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsPath()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 24073); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsPath()"
")"); do { *((volatile int*)__null) = 24073; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
24074 return path._0;
24075 }
24076
24077 static StyleDProperty None() {
24078 StyleDProperty result;
24079 result.tag = Tag::None;
24080 return result;
24081 }
24082
24083 bool IsNone() const {
24084 return tag == Tag::None;
24085 }
24086
24087 bool operator==(const StyleDProperty& other) const {
24088 if (tag != other.tag) {
24089 return false;
24090 }
24091 switch (tag) {
24092 case Tag::Path: return path == other.path;
24093 default: break;
24094 }
24095 return true;
24096 }
24097
24098 bool operator!=(const StyleDProperty& other) const {
24099 return !(*this == other);
24100 }
24101
24102 private:
24103 StyleDProperty() {
24104
24105 }
24106 public:
24107
24108
24109 ~StyleDProperty() {
24110 switch (tag) {
24111 case Tag::Path: path.~StylePath_Body(); break;
24112 default: break;
24113 }
24114 }
24115
24116 StyleDProperty(const StyleDProperty& other)
24117 : tag(other.tag) {
24118 switch (tag) {
24119 case Tag::Path: ::new (&path) (StylePath_Body)(other.path); break;
24120 default: break;
24121 }
24122 }
24123 StyleDProperty& operator=(const StyleDProperty& other) {
24124 if (this != &other) {
24125 this->~StyleDProperty();
24126 new (this) StyleDProperty(other);
24127 }
24128 return *this;
24129 }
24130};
24131
24132/// Values for scrollbar-gutter:
24133/// <https://drafts.csswg.org/css-overflow-3/#scrollbar-gutter-property>
24134struct StyleScrollbarGutter {
24135 uint8_t _0;
24136
24137 constexpr explicit operator bool() const {
24138 return !!_0;
24139 }
24140 constexpr StyleScrollbarGutter operator~() const {
24141 return StyleScrollbarGutter { static_cast<decltype(_0)>(~_0) };
24142 }
24143 constexpr StyleScrollbarGutter operator|(const StyleScrollbarGutter& other) const {
24144 return StyleScrollbarGutter { static_cast<decltype(_0)>(this->_0 | other._0) };
24145 }
24146 StyleScrollbarGutter& operator|=(const StyleScrollbarGutter& other) {
24147 *this = (*this | other);
24148 return *this;
24149 }
24150 constexpr StyleScrollbarGutter operator&(const StyleScrollbarGutter& other) const {
24151 return StyleScrollbarGutter { static_cast<decltype(_0)>(this->_0 & other._0) };
24152 }
24153 StyleScrollbarGutter& operator&=(const StyleScrollbarGutter& other) {
24154 *this = (*this & other);
24155 return *this;
24156 }
24157 constexpr StyleScrollbarGutter operator^(const StyleScrollbarGutter& other) const {
24158 return StyleScrollbarGutter { static_cast<decltype(_0)>(this->_0 ^ other._0) };
24159 }
24160 StyleScrollbarGutter& operator^=(const StyleScrollbarGutter& other) {
24161 *this = (*this ^ other);
24162 return *this;
24163 }
24164 bool operator==(const StyleScrollbarGutter& other) const {
24165 return _0 == other._0;
24166 }
24167 bool operator!=(const StyleScrollbarGutter& other) const {
24168 return _0 != other._0;
24169 }
24170 static const StyleScrollbarGutter AUTO;
24171 static const StyleScrollbarGutter STABLE;
24172 static const StyleScrollbarGutter BOTH_EDGES;
24173};
24174/// `auto` variant. Just for convenience if there is no flag set.
24175constexpr inline const StyleScrollbarGutter StyleScrollbarGutter::AUTO = StyleScrollbarGutter{ /* ._0 = */ (uint8_t)0 };
24176/// `stable` variant.
24177constexpr inline const StyleScrollbarGutter StyleScrollbarGutter::STABLE = StyleScrollbarGutter{ /* ._0 = */ (uint8_t)(1 << 0) };
24178/// `both-edges` variant.
24179constexpr inline const StyleScrollbarGutter StyleScrollbarGutter::BOTH_EDGES = StyleScrollbarGutter{ /* ._0 = */ (uint8_t)(1 << 1) };
24180
24181/// A value for the `hyphenate-character` property.
24182struct StyleHyphenateCharacter {
24183 enum class Tag : uint8_t {
24184 /// `auto`
24185 Auto,
24186 /// `<string>`
24187 String,
24188 };
24189
24190 struct StyleString_Body {
24191 StyleOwnedStr _0;
24192
24193 bool operator==(const StyleString_Body& other) const {
24194 return _0 == other._0;
24195 }
24196 bool operator!=(const StyleString_Body& other) const {
24197 return _0 != other._0;
24198 }
24199 };
24200
24201 Tag tag;
24202 union {
24203 StyleString_Body string;
24204 };
24205
24206 static StyleHyphenateCharacter Auto() {
24207 StyleHyphenateCharacter result;
24208 result.tag = Tag::Auto;
24209 return result;
24210 }
24211
24212 bool IsAuto() const {
24213 return tag == Tag::Auto;
24214 }
24215
24216 static StyleHyphenateCharacter String(const StyleOwnedStr &_0) {
24217 StyleHyphenateCharacter result;
24218 ::new (&result.string._0) (StyleOwnedStr)(_0);
24219 result.tag = Tag::String;
24220 return result;
24221 }
24222
24223 bool IsString() const {
24224 return tag == Tag::String;
24225 }
24226
24227 const StyleOwnedStr& AsString() const {
24228 MOZ_DIAGNOSTIC_ASSERT(IsString())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsString())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsString()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsString()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 24228); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsString()"
")"); do { *((volatile int*)__null) = 24228; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
24229 return string._0;
24230 }
24231
24232 bool operator==(const StyleHyphenateCharacter& other) const {
24233 if (tag != other.tag) {
24234 return false;
24235 }
24236 switch (tag) {
24237 case Tag::String: return string == other.string;
24238 default: break;
24239 }
24240 return true;
24241 }
24242
24243 bool operator!=(const StyleHyphenateCharacter& other) const {
24244 return !(*this == other);
24245 }
24246
24247 private:
24248 StyleHyphenateCharacter() {
24249
24250 }
24251 public:
24252
24253
24254 ~StyleHyphenateCharacter() {
24255 switch (tag) {
24256 case Tag::String: string.~StyleString_Body(); break;
24257 default: break;
24258 }
24259 }
24260
24261 StyleHyphenateCharacter(const StyleHyphenateCharacter& other)
24262 : tag(other.tag) {
24263 switch (tag) {
24264 case Tag::String: ::new (&string) (StyleString_Body)(other.string); break;
24265 default: break;
24266 }
24267 }
24268 StyleHyphenateCharacter& operator=(const StyleHyphenateCharacter& other) {
24269 if (this != &other) {
24270 this->~StyleHyphenateCharacter();
24271 new (this) StyleHyphenateCharacter(other);
24272 }
24273 return *this;
24274 }
24275};
24276
24277/// https://svgwg.org/svg2-draft/coords.html#VectorEffects
24278struct StyleVectorEffect {
24279 uint8_t _0;
24280
24281 constexpr explicit operator bool() const {
24282 return !!_0;
24283 }
24284 constexpr StyleVectorEffect operator~() const {
24285 return StyleVectorEffect { static_cast<decltype(_0)>(~_0) };
24286 }
24287 constexpr StyleVectorEffect operator|(const StyleVectorEffect& other) const {
24288 return StyleVectorEffect { static_cast<decltype(_0)>(this->_0 | other._0) };
24289 }
24290 StyleVectorEffect& operator|=(const StyleVectorEffect& other) {
24291 *this = (*this | other);
24292 return *this;
24293 }
24294 constexpr StyleVectorEffect operator&(const StyleVectorEffect& other) const {
24295 return StyleVectorEffect { static_cast<decltype(_0)>(this->_0 & other._0) };
24296 }
24297 StyleVectorEffect& operator&=(const StyleVectorEffect& other) {
24298 *this = (*this & other);
24299 return *this;
24300 }
24301 constexpr StyleVectorEffect operator^(const StyleVectorEffect& other) const {
24302 return StyleVectorEffect { static_cast<decltype(_0)>(this->_0 ^ other._0) };
24303 }
24304 StyleVectorEffect& operator^=(const StyleVectorEffect& other) {
24305 *this = (*this ^ other);
24306 return *this;
24307 }
24308 bool operator==(const StyleVectorEffect& other) const {
24309 return _0 == other._0;
24310 }
24311 bool operator!=(const StyleVectorEffect& other) const {
24312 return _0 != other._0;
24313 }
24314 bool HasNonScalingStroke() const { return bool(*this & StyleVectorEffect::NON_SCALING_STROKE); }
24315 static const StyleVectorEffect NONE;
24316 static const StyleVectorEffect NON_SCALING_STROKE;
24317};
24318/// `none`
24319constexpr inline const StyleVectorEffect StyleVectorEffect::NONE = StyleVectorEffect{ /* ._0 = */ (uint8_t)0 };
24320/// `non-scaling-stroke`
24321constexpr inline const StyleVectorEffect StyleVectorEffect::NON_SCALING_STROKE = StyleVectorEffect{ /* ._0 = */ (uint8_t)(1 << 0) };
24322
24323/// This is an alias which is useful mostly as a cbindgen / C++ inference workaround.
24324using StyleZoomFixedPoint = StyleFixedPoint<uint16_t, StyleZOOM_FRACTION_BITS>;
24325
24326/// The computed `zoom` property value. We store it as a 16-bit fixed point because we need to
24327/// store it efficiently in the ComputedStyle representation. The assumption being that zooms over
24328/// 1000 aren't quite useful.
24329struct StyleZoom {
24330 StyleZoomFixedPoint _0;
24331
24332 bool operator==(const StyleZoom& other) const {
24333 return _0 == other._0;
24334 }
24335 bool operator!=(const StyleZoom& other) const {
24336 return _0 != other._0;
24337 }
24338 SERVO_FIXED_POINT_HELPERS(StyleZoom, uint16_t, StyleZOOM_FRACTION_BITS)static constexpr uint16_t kPointFive = 1 << (StyleZOOM_FRACTION_BITS
- 1); static constexpr uint16_t kScale = 1 << StyleZOOM_FRACTION_BITS
; static constexpr float kInverseScale = 1.0f / kScale; static
StyleZoom FromRaw(uint16_t aRaw) { return {{aRaw}}; } static
StyleZoom FromFloat(float aFloat) { return FromRaw(uint16_t(
aFloat * kScale)); } static StyleZoom FromInt(uint16_t aInt) {
return FromRaw(uint16_t(aInt * kScale)); } uint16_t Raw() const
{ return _0.value; } uint16_t UnsignedRaw() const { return uint16_t
(Raw()); } float ToFloat() const { return Raw() * kInverseScale
; } uint16_t ToIntRounded() const { return (Raw() + kPointFive
) >> StyleZOOM_FRACTION_BITS; } inline void ToString(nsACString
&) const;
;
24339 inline float Zoom(float) const;
24340 inline float Unzoom(float) const;
24341 inline nscoord ZoomCoord(nscoord) const;
24342 inline nscoord UnzoomCoord(nscoord) const;
24343 inline nsSize Zoom(const nsSize&) const;
24344 inline nsSize Unzoom(const nsSize&) const;
24345 inline nsPoint Zoom(const nsPoint&) const;
24346 inline nsPoint Unzoom(const nsPoint&) const;
24347 inline nsRect Zoom(const nsRect&) const;
24348 inline nsRect Unzoom(const nsRect&) const;
24349 static const StyleZoom ONE;
24350 static const StyleZoom DOCUMENT;
24351};
24352/// The value 1. This is by far the most common value.
24353constexpr inline const StyleZoom StyleZoom::ONE = StyleZoom{ /* ._0 = */ StyleZoomFixedPoint{ /* .value = */ (1 << StyleZOOM_FRACTION_BITS) } };
24354/// The `document` value. This can appear in the computed zoom property value, but not in the
24355/// `effective_zoom` field.
24356constexpr inline const StyleZoom StyleZoom::DOCUMENT = StyleZoom{ /* ._0 = */ StyleZoomFixedPoint{ /* .value = */ 0 } };
24357
24358/// A longhand or shorthand property.
24359struct StyleNonCustomPropertyId {
24360 uint16_t _0;
24361
24362 bool operator==(const StyleNonCustomPropertyId& other) const {
24363 return _0 == other._0;
24364 }
24365 bool operator!=(const StyleNonCustomPropertyId& other) const {
24366 return _0 != other._0;
24367 }
24368};
24369
24370/// A given transition property, that is either `All`, a longhand or shorthand
24371/// property, or an unsupported or custom property.
24372union StyleTransitionProperty {
24373 enum class Tag : uint8_t {
24374 /// A non-custom property.
24375 NonCustom,
24376 /// A custom property.
24377 Custom,
24378 /// Unrecognized property which could be any non-transitionable, custom property, or
24379 /// unknown property.
24380 Unsupported,
24381 };
24382
24383 struct NonCustom_Body {
24384 Tag tag;
24385 StyleNonCustomPropertyId _0;
24386
24387 bool operator==(const NonCustom_Body& other) const {
24388 return _0 == other._0;
24389 }
24390 bool operator!=(const NonCustom_Body& other) const {
24391 return _0 != other._0;
24392 }
24393 };
24394
24395 struct Custom_Body {
24396 Tag tag;
24397 StyleAtom _0;
24398
24399 bool operator==(const Custom_Body& other) const {
24400 return _0 == other._0;
24401 }
24402 bool operator!=(const Custom_Body& other) const {
24403 return _0 != other._0;
24404 }
24405 };
24406
24407 struct Unsupported_Body {
24408 Tag tag;
24409 StyleCustomIdent _0;
24410
24411 bool operator==(const Unsupported_Body& other) const {
24412 return _0 == other._0;
24413 }
24414 bool operator!=(const Unsupported_Body& other) const {
24415 return _0 != other._0;
24416 }
24417 };
24418
24419 struct {
24420 Tag tag;
24421 };
24422 NonCustom_Body non_custom;
24423 Custom_Body custom;
24424 Unsupported_Body unsupported;
24425
24426 static StyleTransitionProperty NonCustom(const StyleNonCustomPropertyId &_0) {
24427 StyleTransitionProperty result;
24428 ::new (&result.non_custom._0) (StyleNonCustomPropertyId)(_0);
24429 result.tag = Tag::NonCustom;
24430 return result;
24431 }
24432
24433 bool IsNonCustom() const {
24434 return tag == Tag::NonCustom;
24435 }
24436
24437 const StyleNonCustomPropertyId& AsNonCustom() const {
24438 MOZ_DIAGNOSTIC_ASSERT(IsNonCustom())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsNonCustom())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsNonCustom()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("IsNonCustom()",
"/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 24438); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsNonCustom()"
")"); do { *((volatile int*)__null) = 24438; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
24439 return non_custom._0;
24440 }
24441
24442 static StyleTransitionProperty Custom(const StyleAtom &_0) {
24443 StyleTransitionProperty result;
24444 ::new (&result.custom._0) (StyleAtom)(_0);
24445 result.tag = Tag::Custom;
24446 return result;
24447 }
24448
24449 bool IsCustom() const {
24450 return tag == Tag::Custom;
24451 }
24452
24453 const StyleAtom& AsCustom() const {
24454 MOZ_DIAGNOSTIC_ASSERT(IsCustom())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCustom())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCustom()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsCustom()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 24454); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsCustom()"
")"); do { *((volatile int*)__null) = 24454; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
24455 return custom._0;
24456 }
24457
24458 static StyleTransitionProperty Unsupported(const StyleCustomIdent &_0) {
24459 StyleTransitionProperty result;
24460 ::new (&result.unsupported._0) (StyleCustomIdent)(_0);
24461 result.tag = Tag::Unsupported;
24462 return result;
24463 }
24464
24465 bool IsUnsupported() const {
24466 return tag == Tag::Unsupported;
24467 }
24468
24469 const StyleCustomIdent& AsUnsupported() const {
24470 MOZ_DIAGNOSTIC_ASSERT(IsUnsupported())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsUnsupported())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsUnsupported()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsUnsupported()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 24470); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsUnsupported()"
")"); do { *((volatile int*)__null) = 24470; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
24471 return unsupported._0;
24472 }
24473
24474 bool operator==(const StyleTransitionProperty& other) const {
24475 if (tag != other.tag) {
24476 return false;
24477 }
24478 switch (tag) {
24479 case Tag::NonCustom: return non_custom == other.non_custom;
24480 case Tag::Custom: return custom == other.custom;
24481 case Tag::Unsupported: return unsupported == other.unsupported;
24482
24483 }
24484 return true;
24485 }
24486
24487 bool operator!=(const StyleTransitionProperty& other) const {
24488 return !(*this == other);
24489 }
24490
24491 private:
24492 StyleTransitionProperty() {
24493
24494 }
24495 public:
24496
24497
24498 ~StyleTransitionProperty() {
24499 switch (tag) {
24500 case Tag::NonCustom: non_custom.~NonCustom_Body(); break;
24501 case Tag::Custom: custom.~Custom_Body(); break;
24502 case Tag::Unsupported: unsupported.~Unsupported_Body(); break;
24503
24504 }
24505 }
24506
24507 StyleTransitionProperty(const StyleTransitionProperty& other)
24508 : tag(other.tag) {
24509 switch (tag) {
24510 case Tag::NonCustom: ::new (&non_custom) (NonCustom_Body)(other.non_custom); break;
24511 case Tag::Custom: ::new (&custom) (Custom_Body)(other.custom); break;
24512 case Tag::Unsupported: ::new (&unsupported) (Unsupported_Body)(other.unsupported); break;
24513
24514 }
24515 }
24516 StyleTransitionProperty& operator=(const StyleTransitionProperty& other) {
24517 if (this != &other) {
24518 this->~StyleTransitionProperty();
24519 new (this) StyleTransitionProperty(other);
24520 }
24521 return *this;
24522 }
24523 bool IsAll() const {
24524 return IsNonCustom() &&
24525 nsCSSPropertyID(AsNonCustom()._0) == eCSSProperty_all;
24526 }
24527};
24528
24529/// The view-transition-name: `none | <custom-ident>`.
24530///
24531/// https://drafts.csswg.org/css-view-transitions-1/#view-transition-name-prop
24532///
24533/// We use a single atom for this. Empty atom represents `none`.
24534struct StyleViewTransitionName {
24535 StyleAtom _0;
24536
24537 bool operator==(const StyleViewTransitionName& other) const {
24538 return _0 == other._0;
24539 }
24540 bool operator!=(const StyleViewTransitionName& other) const {
24541 return _0 != other._0;
24542 }
24543 public:
24544 StyleViewTransitionName() : _0(nsGkAtoms::_empty) {}
24545};
24546
24547/// Specified type for `inset` properties, which allows
24548/// the use of the `anchor()` function.
24549/// Note(dshin): `LengthPercentageOrAuto` is not used here because
24550/// having `LengthPercentageOrAuto` and `AnchorFunction` in the enum
24551/// pays the price of the discriminator for `LengthPercentage | Auto`
24552/// as well as `LengthPercentageOrAuto | AnchorFunction`. This increases
24553/// the size of the style struct, which would not be great.
24554/// On the other hand, we trade for code duplication, so... :(
24555template<typename P, typename LP>
24556struct StyleGenericInset {
24557 enum class Tag {
24558 /// A `<length-percentage>` value.
24559 LengthPercentage,
24560 /// An `auto` value.
24561 Auto,
24562 /// Inset defined by the anchor element.
24563 ///
24564 /// <https://drafts.csswg.org/css-anchor-position-1/#anchor-pos>
24565 AnchorFunction,
24566 /// Inset defined by the size of the anchor element.
24567 ///
24568 /// <https://drafts.csswg.org/css-anchor-position-1/#anchor-pos>
24569 AnchorSizeFunction,
24570 };
24571
24572 struct StyleLengthPercentage_Body {
24573 LP _0;
24574
24575 bool operator==(const StyleLengthPercentage_Body& other) const {
24576 return _0 == other._0;
24577 }
24578 bool operator!=(const StyleLengthPercentage_Body& other) const {
24579 return _0 != other._0;
24580 }
24581 };
24582
24583 struct StyleAnchorFunction_Body {
24584 StyleBox<StyleGenericAnchorFunction<P, LP>> _0;
24585
24586 bool operator==(const StyleAnchorFunction_Body& other) const {
24587 return _0 == other._0;
24588 }
24589 bool operator!=(const StyleAnchorFunction_Body& other) const {
24590 return _0 != other._0;
24591 }
24592 };
24593
24594 struct StyleAnchorSizeFunction_Body {
24595 StyleBox<StyleGenericAnchorSizeFunction<LP>> _0;
24596
24597 bool operator==(const StyleAnchorSizeFunction_Body& other) const {
24598 return _0 == other._0;
24599 }
24600 bool operator!=(const StyleAnchorSizeFunction_Body& other) const {
24601 return _0 != other._0;
24602 }
24603 };
24604
24605 Tag tag;
24606 union {
24607 StyleLengthPercentage_Body length_percentage;
24608 StyleAnchorFunction_Body anchor_function;
24609 StyleAnchorSizeFunction_Body anchor_size_function;
24610 };
24611
24612 static StyleGenericInset LengthPercentage(const LP &_0) {
24613 StyleGenericInset result;
24614 ::new (&result.length_percentage._0) (LP)(_0);
24615 result.tag = Tag::LengthPercentage;
24616 return result;
24617 }
24618
24619 bool IsLengthPercentage() const {
24620 return tag == Tag::LengthPercentage;
24621 }
24622
24623 const LP& AsLengthPercentage() const {
24624 MOZ_DIAGNOSTIC_ASSERT(IsLengthPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLengthPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLengthPercentage()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsLengthPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 24624); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLengthPercentage()"
")"); do { *((volatile int*)__null) = 24624; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
24625 return length_percentage._0;
24626 }
24627
24628 static StyleGenericInset Auto() {
24629 StyleGenericInset result;
24630 result.tag = Tag::Auto;
24631 return result;
24632 }
24633
24634 bool IsAuto() const {
24635 return tag == Tag::Auto;
24636 }
24637
24638 static StyleGenericInset AnchorFunction(const StyleBox<StyleGenericAnchorFunction<P, LP>> &_0) {
24639 StyleGenericInset result;
24640 ::new (&result.anchor_function._0) (StyleBox<StyleGenericAnchorFunction<P, LP>>)(_0);
24641 result.tag = Tag::AnchorFunction;
24642 return result;
24643 }
24644
24645 bool IsAnchorFunction() const {
24646 return tag == Tag::AnchorFunction;
24647 }
24648
24649 const StyleBox<StyleGenericAnchorFunction<P, LP>>& AsAnchorFunction() const {
24650 MOZ_DIAGNOSTIC_ASSERT(IsAnchorFunction())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAnchorFunction())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAnchorFunction()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("IsAnchorFunction()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 24650); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAnchorFunction()"
")"); do { *((volatile int*)__null) = 24650; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
24651 return anchor_function._0;
24652 }
24653
24654 static StyleGenericInset AnchorSizeFunction(const StyleBox<StyleGenericAnchorSizeFunction<LP>> &_0) {
24655 StyleGenericInset result;
24656 ::new (&result.anchor_size_function._0) (StyleBox<StyleGenericAnchorSizeFunction<LP>>)(_0);
24657 result.tag = Tag::AnchorSizeFunction;
24658 return result;
24659 }
24660
24661 bool IsAnchorSizeFunction() const {
24662 return tag == Tag::AnchorSizeFunction;
24663 }
24664
24665 const StyleBox<StyleGenericAnchorSizeFunction<LP>>& AsAnchorSizeFunction() const {
24666 MOZ_DIAGNOSTIC_ASSERT(IsAnchorSizeFunction())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAnchorSizeFunction())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAnchorSizeFunction()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("IsAnchorSizeFunction()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 24666); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAnchorSizeFunction()"
")"); do { *((volatile int*)__null) = 24666; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
24667 return anchor_size_function._0;
24668 }
24669
24670 bool operator==(const StyleGenericInset& other) const {
24671 if (tag != other.tag) {
24672 return false;
24673 }
24674 switch (tag) {
24675 case Tag::LengthPercentage: return length_percentage == other.length_percentage;
24676 case Tag::AnchorFunction: return anchor_function == other.anchor_function;
24677 case Tag::AnchorSizeFunction: return anchor_size_function == other.anchor_size_function;
24678 default: break;
24679 }
24680 return true;
24681 }
24682
24683 bool operator!=(const StyleGenericInset& other) const {
24684 return !(*this == other);
24685 }
24686
24687 private:
24688 StyleGenericInset() {
24689
24690 }
24691 public:
24692
24693
24694 ~StyleGenericInset() {
24695 switch (tag) {
24696 case Tag::LengthPercentage: length_percentage.~StyleLengthPercentage_Body(); break;
24697 case Tag::AnchorFunction: anchor_function.~StyleAnchorFunction_Body(); break;
24698 case Tag::AnchorSizeFunction: anchor_size_function.~StyleAnchorSizeFunction_Body(); break;
24699 default: break;
24700 }
24701 }
24702
24703 StyleGenericInset(const StyleGenericInset& other)
24704 : tag(other.tag) {
24705 switch (tag) {
24706 case Tag::LengthPercentage: ::new (&length_percentage) (StyleLengthPercentage_Body)(other.length_percentage); break;
24707 case Tag::AnchorFunction: ::new (&anchor_function) (StyleAnchorFunction_Body)(other.anchor_function); break;
24708 case Tag::AnchorSizeFunction: ::new (&anchor_size_function) (StyleAnchorSizeFunction_Body)(other.anchor_size_function); break;
24709 default: break;
24710 }
24711 }
24712 StyleGenericInset& operator=(const StyleGenericInset& other) {
24713 if (this != &other) {
24714 this->~StyleGenericInset();
24715 new (this) StyleGenericInset(other);
24716 }
24717 return *this;
24718 }
24719 inline bool HasPercent() const;
24720 inline bool ConvertsToLength() const;
24721 inline bool HasLengthAndPercentage() const;
24722 inline bool IsAnchorPositioningFunction() const;
24723 inline nscoord ToLength() const;
24724 inline bool ConvertsToPercentage() const;
24725 inline float ToPercentage() const;
24726};
24727
24728/// A computed type for `inset` properties.
24729using StyleInset = StyleGenericInset<StylePercentage, StyleLengthPercentage>;
24730
24731/// The computed value of an `anchor()` function.
24732using StyleAnchorFunction = StyleGenericAnchorFunction<StylePercentage, StyleLengthPercentage>;
24733
24734/// A computed value for `anchor-size` runction.
24735using StyleAnchorSizeFunction = StyleGenericAnchorSizeFunction<StyleLengthPercentage>;
24736
24737/// Specified type for `margin` properties, which allows
24738/// the use of the `anchor-size()` function.
24739template<typename LP>
24740struct StyleGenericMargin {
24741 enum class Tag {
24742 /// A `<length-percentage>` value.
24743 LengthPercentage,
24744 /// An `auto` value.
24745 Auto,
24746 /// Margin size defined by the anchor element.
24747 ///
24748 /// https://drafts.csswg.org/css-anchor-position-1/#funcdef-anchor-size
24749 AnchorSizeFunction,
24750 };
24751
24752 struct StyleLengthPercentage_Body {
24753 LP _0;
24754
24755 bool operator==(const StyleLengthPercentage_Body& other) const {
24756 return _0 == other._0;
24757 }
24758 bool operator!=(const StyleLengthPercentage_Body& other) const {
24759 return _0 != other._0;
24760 }
24761 };
24762
24763 struct StyleAnchorSizeFunction_Body {
24764 StyleBox<StyleGenericAnchorSizeFunction<LP>> _0;
24765
24766 bool operator==(const StyleAnchorSizeFunction_Body& other) const {
24767 return _0 == other._0;
24768 }
24769 bool operator!=(const StyleAnchorSizeFunction_Body& other) const {
24770 return _0 != other._0;
24771 }
24772 };
24773
24774 Tag tag;
24775 union {
24776 StyleLengthPercentage_Body length_percentage;
24777 StyleAnchorSizeFunction_Body anchor_size_function;
24778 };
24779
24780 static StyleGenericMargin LengthPercentage(const LP &_0) {
24781 StyleGenericMargin result;
24782 ::new (&result.length_percentage._0) (LP)(_0);
24783 result.tag = Tag::LengthPercentage;
24784 return result;
24785 }
24786
24787 bool IsLengthPercentage() const {
24788 return tag == Tag::LengthPercentage;
24789 }
24790
24791 const LP& AsLengthPercentage() const {
24792 MOZ_DIAGNOSTIC_ASSERT(IsLengthPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLengthPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLengthPercentage()))), 0))
) { do { } while (false); MOZ_ReportAssertionFailure("IsLengthPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 24792); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsLengthPercentage()"
")"); do { *((volatile int*)__null) = 24792; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
24793 return length_percentage._0;
24794 }
24795
24796 static StyleGenericMargin Auto() {
24797 StyleGenericMargin result;
24798 result.tag = Tag::Auto;
24799 return result;
24800 }
24801
24802 bool IsAuto() const {
24803 return tag == Tag::Auto;
24804 }
24805
24806 static StyleGenericMargin AnchorSizeFunction(const StyleBox<StyleGenericAnchorSizeFunction<LP>> &_0) {
24807 StyleGenericMargin result;
24808 ::new (&result.anchor_size_function._0) (StyleBox<StyleGenericAnchorSizeFunction<LP>>)(_0);
24809 result.tag = Tag::AnchorSizeFunction;
24810 return result;
24811 }
24812
24813 bool IsAnchorSizeFunction() const {
24814 return tag == Tag::AnchorSizeFunction;
24815 }
24816
24817 const StyleBox<StyleGenericAnchorSizeFunction<LP>>& AsAnchorSizeFunction() const {
24818 MOZ_DIAGNOSTIC_ASSERT(IsAnchorSizeFunction())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsAnchorSizeFunction())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsAnchorSizeFunction()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("IsAnchorSizeFunction()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConsts.h"
, 24818); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "IsAnchorSizeFunction()"
")"); do { *((volatile int*)__null) = 24818; __attribute__((
nomerge)) ::abort(); } while (false); } } while (false)
;
24819 return anchor_size_function._0;
24820 }
24821
24822 bool operator==(const StyleGenericMargin& other) const {
24823 if (tag != other.tag) {
24824 return false;
24825 }
24826 switch (tag) {
24827 case Tag::LengthPercentage: return length_percentage == other.length_percentage;
24828 case Tag::AnchorSizeFunction: return anchor_size_function == other.anchor_size_function;
24829 default: break;
24830 }
24831 return true;
24832 }
24833
24834 bool operator!=(const StyleGenericMargin& other) const {
24835 return !(*this == other);
24836 }
24837
24838 private:
24839 StyleGenericMargin() {
24840
24841 }
24842 public:
24843
24844
24845 ~StyleGenericMargin() {
24846 switch (tag) {
24847 case Tag::LengthPercentage: length_percentage.~StyleLengthPercentage_Body(); break;
24848 case Tag::AnchorSizeFunction: anchor_size_function.~StyleAnchorSizeFunction_Body(); break;
24849 default: break;
24850 }
24851 }
24852
24853 StyleGenericMargin(const StyleGenericMargin& other)
24854 : tag(other.tag) {
24855 switch (tag) {
24856 case Tag::LengthPercentage: ::new (&length_percentage) (StyleLengthPercentage_Body)(other.length_percentage); break;
24857 case Tag::AnchorSizeFunction: ::new (&anchor_size_function) (StyleAnchorSizeFunction_Body)(other.anchor_size_function); break;
24858 default: break;
24859 }
24860 }
24861 StyleGenericMargin& operator=(const StyleGenericMargin& other) {
24862 if (this != &other) {
24863 this->~StyleGenericMargin();
24864 new (this) StyleGenericMargin(other);
24865 }
24866 return *this;
24867 }
24868 inline bool HasPercent() const;
24869 inline bool ConvertsToLength() const;
24870 inline bool HasLengthAndPercentage() const;
24871 inline nscoord ToLength() const;
24872 inline bool ConvertsToPercentage() const;
24873 inline float ToPercentage() const;
24874};
24875
24876/// A computed type for `margin` properties.
24877using StyleMargin = StyleGenericMargin<StyleLengthPercentage>;
24878
24879
24880
24881
24882
24883
24884
24885
24886
24887
24888
24889
24890
24891
24892
24893
24894
24895
24896
24897
24898
24899
24900
24901
24902
24903
24904
24905
24906
24907
24908
24909
24910
24911
24912
24913
24914
24915
24916
24917
24918
24919
24920
24921
24922
24923
24924
24925
24926
24927
24928
24929
24930
24931
24932
24933
24934
24935
24936
24937
24938
24939
24940
24941
24942
24943
24944
24945
24946
24947
24948
24949
24950
24951
24952
24953
24954
24955
24956
24957
24958
24959
24960
24961
24962
24963
24964
24965
24966
24967
24968
24969
24970
24971
24972
24973
24974
24975
24976
24977
24978
24979
24980
24981
24982
24983
24984
24985
24986
24987
24988
24989
24990
24991
24992
24993
24994
24995
24996
24997
24998
24999
25000
25001
25002
25003
25004
25005
25006
25007
25008
25009/// Number of pixels per inch
25010constexpr static const StyleCSSFloat StylePX_PER_IN = 96.;
25011
25012/// Number of pixels per centimeter
25013constexpr static const StyleCSSFloat StylePX_PER_CM = (StylePX_PER_IN / 2.54);
25014
25015/// Number of pixels per millimeter
25016constexpr static const StyleCSSFloat StylePX_PER_MM = (StylePX_PER_IN / 25.4);
25017
25018/// Number of pixels per quarter
25019constexpr static const StyleCSSFloat StylePX_PER_Q = (StylePX_PER_MM / 4.);
25020
25021/// Number of pixels per point
25022constexpr static const StyleCSSFloat StylePX_PER_PT = (StylePX_PER_IN / 72.);
25023
25024/// Number of pixels per pica
25025constexpr static const StyleCSSFloat StylePX_PER_PC = (StylePX_PER_PT * 12.);
25026
25027
25028
25029
25030
25031
25032
25033
25034
25035
25036
25037
25038
25039
25040
25041
25042
25043
25044
25045
25046
25047
25048
25049
25050
25051
25052
25053
25054
25055
25056
25057
25058
25059
25060
25061
25062
25063
25064
25065
25066
25067
25068
25069
25070
25071
25072
25073
25074
25075extern "C" {
25076
25077size_t je_malloc_usable_size(const void*);
25078
25079void Servo_Initialize(URLExtraData *dummy_url_data,
25080 URLExtraData *dummy_chrome_url_data);
25081
25082void Servo_Shutdown();
25083
25084/// Traverses the subtree rooted at `root` for restyling.
25085///
25086/// Returns whether the root was restyled. Whether anything else was restyled or
25087/// not can be inferred from the dirty bits in the rest of the tree.
25088bool Servo_TraverseSubtree(const StyleRawGeckoElement *root,
25089 const StylePerDocumentStyleData *raw_data,
25090 const ServoElementSnapshotTable *snapshots,
25091 ServoTraversalFlags raw_flags);
25092
25093/// Checks whether the rule tree has crossed its threshold for unused nodes, and
25094/// if so, frees them.
25095void Servo_MaybeGCRuleTree(const StylePerDocumentStyleData *raw_data);
25096
25097StyleStrong<StyleAnimationValue> Servo_AnimationValues_Interpolate(const StyleAnimationValue *from,
25098 const StyleAnimationValue *to,
25099 double progress);
25100
25101bool Servo_AnimationValues_IsInterpolable(const StyleAnimationValue *from,
25102 const StyleAnimationValue *to);
25103
25104StyleStrong<StyleAnimationValue> Servo_AnimationValues_Add(const StyleAnimationValue *a,
25105 const StyleAnimationValue *b);
25106
25107StyleStrong<StyleAnimationValue> Servo_AnimationValues_Accumulate(const StyleAnimationValue *a,
25108 const StyleAnimationValue *b,
25109 uint64_t count);
25110
25111StyleStrong<StyleAnimationValue> Servo_AnimationValues_GetZeroValue(const StyleAnimationValue *value_to_match);
25112
25113double Servo_AnimationValues_ComputeDistance(const StyleAnimationValue *from,
25114 const StyleAnimationValue *to);
25115
25116StyleStrong<StyleAnimationValue> Servo_ComposeAnimationSegment(const AnimationPropertySegment *segment,
25117 const StyleAnimationValue *underlying_value,
25118 const StyleAnimationValue *last_value,
25119 StyleIterationCompositeOperation iteration_composite,
25120 double progress,
25121 uint64_t current_iteration);
25122
25123void Servo_AnimationCompose(StyleAnimationValueMap *value_map,
25124 const RawServoAnimationValueTable *base_values,
25125 const AnimatedPropertyID *css_property,
25126 const AnimationPropertySegment *segment,
25127 const AnimationPropertySegment *last_segment,
25128 const ComputedTiming *computed_timing,
25129 StyleIterationCompositeOperation iteration_composite);
25130
25131void Servo_AnimationValue_Serialize(const StyleAnimationValue *value,
25132 const AnimatedPropertyID *property,
25133 const StylePerDocumentStyleData *raw_data,
25134 nsACString *buffer);
25135
25136/// Debug: MOZ_DBG for AnimationValue.
25137void Servo_AnimationValue_Dump(const StyleAnimationValue *value,
25138 nsACString *result);
25139
25140nscolor Servo_AnimationValue_GetColor(const StyleAnimationValue *value,
25141 nscolor foreground_color);
25142
25143bool Servo_AnimationValue_IsCurrentColor(const StyleAnimationValue *value);
25144
25145float Servo_AnimationValue_GetOpacity(const StyleAnimationValue *value);
25146
25147StyleStrong<StyleAnimationValue> Servo_AnimationValue_Opacity(float opacity);
25148
25149StyleStrong<StyleAnimationValue> Servo_AnimationValue_Color(nsCSSPropertyID color_property,
25150 nscolor color);
25151
25152const StyleScale *Servo_AnimationValue_GetScale(const StyleAnimationValue *value);
25153
25154const StyleTranslate *Servo_AnimationValue_GetTranslate(const StyleAnimationValue *value);
25155
25156const StyleRotate *Servo_AnimationValue_GetRotate(const StyleAnimationValue *value);
25157
25158const StyleTransform *Servo_AnimationValue_GetTransform(const StyleAnimationValue *value);
25159
25160void Servo_AnimationValue_GetOffsetPath(const StyleAnimationValue *value,
25161 StyleOffsetPath *output);
25162
25163const StyleLengthPercentage *Servo_AnimationValue_GetOffsetDistance(const StyleAnimationValue *value);
25164
25165const StyleOffsetRotate *Servo_AnimationValue_GetOffsetRotate(const StyleAnimationValue *value);
25166
25167const StylePositionOrAuto *Servo_AnimationValue_GetOffsetAnchor(const StyleAnimationValue *value);
25168
25169const StyleOffsetPosition *Servo_AnimationValue_GetOffsetPosition(const StyleAnimationValue *value);
25170
25171bool Servo_AnimationValue_IsOffsetPathUrl(const StyleAnimationValue *value);
25172
25173StyleStrong<StyleAnimationValue> Servo_AnimationValue_Rotate(const StyleRotate *r);
25174
25175StyleStrong<StyleAnimationValue> Servo_AnimationValue_Translate(const StyleTranslate *t);
25176
25177StyleStrong<StyleAnimationValue> Servo_AnimationValue_Scale(const StyleScale *s);
25178
25179StyleStrong<StyleAnimationValue> Servo_AnimationValue_Transform(const StyleTransform *transform);
25180
25181StyleStrong<StyleAnimationValue> Servo_AnimationValue_OffsetPath(const StyleOffsetPath *p);
25182
25183StyleStrong<StyleAnimationValue> Servo_AnimationValue_OffsetDistance(const StyleLengthPercentage *d);
25184
25185StyleStrong<StyleAnimationValue> Servo_AnimationValue_OffsetRotate(const StyleOffsetRotate *r);
25186
25187StyleStrong<StyleAnimationValue> Servo_AnimationValue_OffsetAnchor(const StylePositionOrAuto *p);
25188
25189StyleStrong<StyleAnimationValue> Servo_AnimationValue_OffsetPosition(const StyleOffsetPosition *p);
25190
25191bool Servo_AnimationValue_DeepEqual(const StyleAnimationValue *this_,
25192 const StyleAnimationValue *other);
25193
25194StyleStrong<StyleLockedDeclarationBlock> Servo_AnimationValue_Uncompute(const StyleAnimationValue *value);
25195
25196StyleAnimationValueMap *Servo_AnimationValueMap_Create();
25197
25198void Servo_AnimationValueMap_Drop(StyleAnimationValueMap *value_map);
25199
25200StyleStrong<StyleAnimationValue> Servo_AnimationValueMap_GetValue(const StyleAnimationValueMap *value_map,
25201 const AnimatedPropertyID *property_id);
25202
25203StyleStrong<StyleComputedValues> Servo_StyleSet_GetBaseComputedValuesForElement(const StylePerDocumentStyleData *raw_style_set,
25204 const StyleRawGeckoElement *element,
25205 const StyleComputedValues *computed_values,
25206 const ServoElementSnapshotTable *snapshots);
25207
25208StyleShouldTransitionResult Servo_ComputedValues_ShouldTransition(const StyleComputedValues *old,
25209 const StyleComputedValues *new_,
25210 const AnimatedPropertyID *prop,
25211 StyleTransitionBehavior behavior,
25212 const StyleAnimationValue *old_transition_end_value,
25213 const StyleAnimationValue *current_start_value,
25214 const StyleAnimationValue *current_end_value,
25215 const double *progress,
25216 RefPtr<StyleAnimationValue> *start,
25217 RefPtr<StyleAnimationValue> *end);
25218
25219bool Servo_ComputedValues_TransitionValueMatches(const StyleComputedValues *style,
25220 const AnimatedPropertyID *prop,
25221 const StyleAnimationValue *transition_value);
25222
25223StyleStrong<StyleAnimationValue> Servo_ComputedValues_ExtractAnimationValue(const StyleComputedValues *computed_values,
25224 const AnimatedPropertyID *property_id);
25225
25226nsCSSPropertyID Servo_ResolveLogicalProperty(nsCSSPropertyID property_id,
25227 const StyleComputedValues *style);
25228
25229nsCSSPropertyID Servo_Property_LookupEnabledForAllContent(const nsACString *prop);
25230
25231const uint8_t *Servo_Property_GetName(nsCSSPropertyID prop,
25232 uint32_t *out_length);
25233
25234bool Servo_Property_IsShorthand(const nsACString *prop_name, bool *found);
25235
25236bool Servo_Property_IsInherited(const StylePerDocumentStyleData *per_doc_data,
25237 const nsACString *prop_name);
25238
25239bool Servo_Property_SupportsType(const nsACString *prop_name,
25240 uint8_t ty,
25241 bool *found);
25242
25243void Servo_Property_GetCSSValuesForProperty(const nsACString *prop_name,
25244 bool *found,
25245 nsTArray<nsString> *result);
25246
25247bool Servo_Property_IsAnimatable(const AnimatedPropertyID *prop);
25248
25249bool Servo_Property_IsDiscreteAnimatable(nsCSSPropertyID property);
25250
25251void Servo_Element_ClearData(const StyleRawGeckoElement *element);
25252
25253uintptr_t Servo_Element_SizeOfExcludingThisAndCVs(StyleGeckoMallocSizeOf malloc_size_of,
25254 StyleGeckoMallocSizeOf malloc_enclosing_size_of,
25255 SeenPtrs *seen_ptrs,
25256 const StyleRawGeckoElement *element);
25257
25258const StyleComputedValues *Servo_Element_GetMaybeOutOfDateStyle(const StyleRawGeckoElement *element);
25259
25260const StyleComputedValues *Servo_Element_GetMaybeOutOfDatePseudoStyle(const StyleRawGeckoElement *element,
25261 uintptr_t index);
25262
25263bool Servo_Element_IsDisplayNone(const StyleRawGeckoElement *element);
25264
25265bool Servo_Element_IsDisplayContents(const StyleRawGeckoElement *element);
25266
25267bool Servo_Element_IsPrimaryStyleReusedViaRuleNode(const StyleRawGeckoElement *element);
25268
25269bool Servo_Element_MayHaveStartingStyle(const StyleRawGeckoElement *element);
25270
25271StyleStrong<StyleStylesheetContents> Servo_StyleSheet_Empty(StyleSheetParsingMode mode);
25272
25273/// Note: The load_data corresponds to this sheet, and is passed as the parent
25274/// load data for child sheet loads. It may be null for certain cases where we
25275/// know we won't have child loads.
25276StyleStrong<StyleStylesheetContents> Servo_StyleSheet_FromUTF8Bytes(StyleLoader *loader,
25277 StyleDomStyleSheet *stylesheet,
25278 StyleSheetLoadData *load_data,
25279 const nsACString *bytes,
25280 StyleSheetParsingMode mode,
25281 URLExtraData *extra_data,
25282 nsCompatibility quirks_mode,
25283 StyleLoaderReusableStyleSheets *reusable_sheets,
25284 const StyleUseCounters *use_counters,
25285 StyleAllowImportRules allow_import_rules,
25286 StyleSanitizationKind sanitization_kind,
25287 nsAString *sanitized_output);
25288
25289void Servo_StyleSheet_FromUTF8BytesAsync(StyleSheetLoadDataHolder *load_data,
25290 URLExtraData *extra_data,
25291 const nsACString *bytes,
25292 StyleSheetParsingMode mode,
25293 nsCompatibility quirks_mode,
25294 bool should_record_use_counters,
25295 StyleAllowImportRules allow_import_rules);
25296
25297void Servo_ShutdownThreadPool();
25298
25299void Servo_ThreadPool_GetThreadHandles(nsTArray<StylePlatformThreadHandle> *handles);
25300
25301StyleStrong<StyleStylesheetContents> Servo_StyleSheet_FromSharedData(URLExtraData *extra_data,
25302 const StyleLockedCssRules *shared_rules);
25303
25304void Servo_StyleSet_AppendStyleSheet(const StylePerDocumentStyleData *raw_data,
25305 const StyleDomStyleSheet *sheet);
25306
25307StyleAuthorStyles *Servo_AuthorStyles_Create();
25308
25309void Servo_AuthorStyles_Drop(StyleAuthorStyles *styles);
25310
25311void Servo_AuthorStyles_AppendStyleSheet(StyleAuthorStyles *styles,
25312 const StyleDomStyleSheet *sheet);
25313
25314void Servo_AuthorStyles_InsertStyleSheetBefore(StyleAuthorStyles *styles,
25315 const StyleDomStyleSheet *sheet,
25316 const StyleDomStyleSheet *before_sheet);
25317
25318void Servo_AuthorStyles_RemoveStyleSheet(StyleAuthorStyles *styles,
25319 const StyleDomStyleSheet *sheet);
25320
25321void Servo_AuthorStyles_ForceDirty(StyleAuthorStyles *styles);
25322
25323bool Servo_AuthorStyles_IsDirty(const StyleAuthorStyles *styles);
25324
25325void Servo_AuthorStyles_Flush(StyleAuthorStyles *styles,
25326 const StylePerDocumentStyleData *document_set);
25327
25328void Servo_StyleSet_RemoveUniqueEntriesFromAuthorStylesCache(const StylePerDocumentStyleData *document_set);
25329
25330uintptr_t Servo_DeclarationBlock_SizeOfIncludingThis(StyleGeckoMallocSizeOf malloc_size_of,
25331 StyleGeckoMallocSizeOf malloc_enclosing_size_of,
25332 const StyleLockedDeclarationBlock *declarations);
25333
25334uintptr_t Servo_AuthorStyles_SizeOfIncludingThis(StyleGeckoMallocSizeOf malloc_size_of,
25335 StyleGeckoMallocSizeOf malloc_enclosing_size_of,
25336 const StyleAuthorStyles *styles);
25337
25338MediumFeaturesChangedResult Servo_StyleSet_MediumFeaturesChanged(const StylePerDocumentStyleData *document_set,
25339 nsTArray<StyleAuthorStyles*> *non_document_styles,
25340 bool may_affect_default_style);
25341
25342void Servo_StyleSet_InsertStyleSheetBefore(const StylePerDocumentStyleData *raw_data,
25343 const StyleDomStyleSheet *sheet,
25344 const StyleDomStyleSheet *before_sheet);
25345
25346void Servo_StyleSet_RemoveStyleSheet(const StylePerDocumentStyleData *raw_data,
25347 const StyleDomStyleSheet *sheet);
25348
25349const StyleDomStyleSheet *Servo_StyleSet_GetSheetAt(const StylePerDocumentStyleData *raw_data,
25350 StyleOrigin origin,
25351 uintptr_t index);
25352
25353uintptr_t Servo_StyleSet_GetSheetCount(const StylePerDocumentStyleData *raw_data,
25354 StyleOrigin origin);
25355
25356void Servo_StyleSet_FlushStyleSheets(const StylePerDocumentStyleData *raw_data,
25357 const StyleRawGeckoElement *doc_element,
25358 const ServoElementSnapshotTable *snapshots);
25359
25360void Servo_StyleSet_NoteStyleSheetsChanged(const StylePerDocumentStyleData *raw_data,
25361 OriginFlags changed_origins);
25362
25363void Servo_StyleSet_SetAuthorStyleDisabled(const StylePerDocumentStyleData *raw_data,
25364 bool author_style_disabled);
25365
25366bool Servo_StyleSet_UsesFontMetrics(const StylePerDocumentStyleData *raw_data);
25367
25368bool Servo_StyleSheet_HasRules(const StyleStylesheetContents *raw_contents);
25369
25370StyleStrong<StyleLockedCssRules> Servo_StyleSheet_GetRules(const StyleStylesheetContents *sheet);
25371
25372StyleStrong<StyleStylesheetContents> Servo_StyleSheet_Clone(const StyleStylesheetContents *contents);
25373
25374uintptr_t Servo_StyleSheet_SizeOfIncludingThis(StyleGeckoMallocSizeOf malloc_size_of,
25375 StyleGeckoMallocSizeOf malloc_enclosing_size_of,
25376 const StyleStylesheetContents *sheet);
25377
25378StyleOrigin Servo_StyleSheet_GetOrigin(const StyleStylesheetContents *sheet);
25379
25380void Servo_StyleSheet_GetSourceMapURL(const StyleStylesheetContents *contents,
25381 nsACString *result);
25382
25383void Servo_StyleSheet_GetSourceURL(const StyleStylesheetContents *contents,
25384 nsACString *result);
25385
25386uintptr_t Servo_CssRules_GetRuleCount(const StyleLockedCssRules *rules);
25387
25388StyleCssRuleType Servo_CssRules_GetRuleTypeAt(const StyleLockedCssRules *rules,
25389 uintptr_t index);
25390
25391void Servo_CssRules_ListTypes(const StyleLockedCssRules *rules,
25392 nsTArray<uintptr_t> *result);
25393
25394nsresult Servo_CssRules_InsertRule(const StyleLockedCssRules *rules,
25395 const StyleStylesheetContents *contents,
25396 const nsACString *rule,
25397 uint32_t index,
25398 uint32_t containing_rule_types,
25399 const StyleCssRuleType *parse_relative_rule_type,
25400 StyleLoader *loader,
25401 StyleAllowImportRules allow_import_rules,
25402 StyleDomStyleSheet *gecko_stylesheet,
25403 StyleCssRuleType *rule_type);
25404
25405nsresult Servo_CssRules_DeleteRule(const StyleLockedCssRules *rules,
25406 uint32_t index);
25407
25408StyleStrong<StyleLockedCssRules> Servo_StyleRule_EnsureRules(const StyleLockedStyleRule *rule,
25409 bool read_only);
25410
25411StyleStrong<StyleLockedDeclarationBlock> Servo_NestedDeclarationsRule_GetStyle(const StyleLockedNestedDeclarationsRule *rule);
25412
25413void Servo_NestedDeclarationsRule_SetStyle(const StyleLockedNestedDeclarationsRule *rule,
25414 const StyleLockedDeclarationBlock *declarations);
25415
25416StyleStrong<StyleLockedDeclarationBlock> Servo_StyleRule_GetStyle(const StyleLockedStyleRule *rule);
25417
25418void Servo_StyleRule_SetStyle(const StyleLockedStyleRule *rule,
25419 const StyleLockedDeclarationBlock *declarations);
25420
25421void Servo_StyleRule_GetSelectorText(const StyleLockedStyleRule *rule,
25422 nsACString *result);
25423
25424StyleSelectorList *Servo_StyleRule_GetSelectorList(const nsTArray<const StyleLockedStyleRule*> *rules);
25425
25426void Servo_StyleRule_GetSelectorDataAtIndex(const nsTArray<const StyleLockedStyleRule*> *rules,
25427 uint32_t index,
25428 nsACString *text,
25429 uint64_t *specificity);
25430
25431uint32_t Servo_StyleRule_GetSelectorCount(const StyleLockedStyleRule *rule);
25432
25433bool Servo_StyleRule_SelectorMatchesElement(const nsTArray<const StyleLockedStyleRule*> *rules,
25434 const StyleRawGeckoElement *element,
25435 uint32_t index,
25436 const StyleRawGeckoElement *host,
25437 PseudoStyleType pseudo_type,
25438 bool relevant_link_visited);
25439
25440bool Servo_StyleRule_SetSelectorText(const StyleStylesheetContents *contents,
25441 const StyleLockedStyleRule *rule,
25442 const nsACString *text,
25443 const StyleCssRuleType *parse_relative_rule_type);
25444
25445const StyleRawGeckoElement *Servo_SelectorList_Closest(const StyleRawGeckoElement *element,
25446 const StyleSelectorList *selectors);
25447
25448bool Servo_SelectorList_Matches(const StyleRawGeckoElement *element,
25449 const StyleSelectorList *selectors);
25450
25451const StyleRawGeckoElement *Servo_SelectorList_QueryFirst(const StyleRawGeckoNode *node,
25452 const StyleSelectorList *selectors,
25453 bool may_use_invalidation);
25454
25455void Servo_SelectorList_QueryAll(const StyleRawGeckoNode *node,
25456 const StyleSelectorList *selectors,
25457 nsSimpleContentList *content_list,
25458 bool may_use_invalidation);
25459
25460void Servo_ImportRule_GetHref(const StyleLockedImportRule *rule,
25461 nsAString *result);
25462
25463void Servo_ImportRule_GetLayerName(const StyleLockedImportRule *rule,
25464 nsACString *result);
25465
25466void Servo_ImportRule_GetSupportsText(const StyleLockedImportRule *rule,
25467 nsACString *result);
25468
25469const StyleDomStyleSheet *Servo_ImportRule_GetSheet(const StyleLockedImportRule *rule);
25470
25471void Servo_ImportRule_SetSheet(const StyleLockedImportRule *rule,
25472 StyleDomStyleSheet *sheet);
25473
25474void Servo_Keyframe_GetKeyText(const StyleLockedKeyframe *keyframe,
25475 nsACString *result);
25476
25477bool Servo_Keyframe_SetKeyText(const StyleLockedKeyframe *keyframe,
25478 const nsACString *text);
25479
25480StyleStrong<StyleLockedDeclarationBlock> Servo_Keyframe_GetStyle(const StyleLockedKeyframe *keyframe);
25481
25482void Servo_Keyframe_SetStyle(const StyleLockedKeyframe *keyframe,
25483 const StyleLockedDeclarationBlock *declarations);
25484
25485nsAtom *Servo_KeyframesRule_GetName(const StyleLockedKeyframesRule *rule);
25486
25487void Servo_KeyframesRule_SetName(const StyleLockedKeyframesRule *rule,
25488 nsAtom *name);
25489
25490uint32_t Servo_KeyframesRule_GetCount(const StyleLockedKeyframesRule *rule);
25491
25492StyleStrong<StyleLockedKeyframe> Servo_KeyframesRule_GetKeyframeAt(const StyleLockedKeyframesRule *rule,
25493 uint32_t index,
25494 uint32_t *line,
25495 uint32_t *column);
25496
25497uint32_t Servo_KeyframesRule_FindRule(const StyleLockedKeyframesRule *rule,
25498 const nsACString *key);
25499
25500bool Servo_KeyframesRule_AppendRule(const StyleLockedKeyframesRule *rule,
25501 const StyleStylesheetContents *contents,
25502 const nsACString *css);
25503
25504void Servo_KeyframesRule_DeleteRule(const StyleLockedKeyframesRule *rule,
25505 uint32_t index);
25506
25507StyleStrong<StyleLockedMediaList> Servo_MediaRule_GetMedia(const StyleMediaRule *rule);
25508
25509nsAtom *Servo_NamespaceRule_GetPrefix(const StyleNamespaceRule *rule);
25510
25511nsAtom *Servo_NamespaceRule_GetURI(const StyleNamespaceRule *rule);
25512
25513StyleStrong<StyleLockedDeclarationBlock> Servo_MarginRule_GetStyle(const StyleMarginRule *rule);
25514
25515void Servo_MarginRule_GetName(const StyleMarginRule *rule, nsACString *out);
25516
25517StyleStrong<StyleLockedDeclarationBlock> Servo_PageRule_GetStyle(const StyleLockedPageRule *rule);
25518
25519void Servo_PageRule_SetStyle(const StyleLockedPageRule *rule,
25520 const StyleLockedDeclarationBlock *declarations);
25521
25522void Servo_PageRule_GetSelectorText(const StyleLockedPageRule *rule,
25523 nsACString *result);
25524
25525bool Servo_PageRule_SetSelectorText(const StyleStylesheetContents *contents,
25526 const StyleLockedPageRule *rule,
25527 const nsACString *text);
25528
25529void Servo_PropertyRule_GetName(const StylePropertyRule *rule,
25530 nsACString *result);
25531
25532void Servo_PropertyRule_GetSyntax(const StylePropertyRule *rule,
25533 nsACString *result);
25534
25535bool Servo_PropertyRule_GetInherits(const StylePropertyRule *rule);
25536
25537bool Servo_PropertyRule_GetInitialValue(const StylePropertyRule *rule,
25538 nsACString *result);
25539
25540void Servo_SupportsRule_GetConditionText(const StyleSupportsRule *rule,
25541 nsACString *result);
25542
25543void Servo_ContainerRule_GetConditionText(const StyleContainerRule *rule,
25544 nsACString *result);
25545
25546void Servo_ContainerRule_GetContainerQuery(const StyleContainerRule *rule,
25547 nsACString *result);
25548
25549const StyleRawGeckoElement *Servo_ContainerRule_QueryContainerFor(const StyleContainerRule *rule,
25550 const StyleRawGeckoElement *element);
25551
25552void Servo_ContainerRule_GetContainerName(const StyleContainerRule *rule,
25553 nsACString *result);
25554
25555void Servo_DocumentRule_GetConditionText(const StyleDocumentRule *rule,
25556 nsACString *result);
25557
25558void Servo_FontFeatureValuesRule_GetFontFamily(const StyleFontFeatureValuesRule *rule,
25559 nsACString *result);
25560
25561void Servo_FontFeatureValuesRule_GetValueText(const StyleFontFeatureValuesRule *rule,
25562 nsACString *result);
25563
25564void Servo_FontPaletteValuesRule_GetName(const StyleFontPaletteValuesRule *rule,
25565 nsACString *result);
25566
25567void Servo_FontPaletteValuesRule_GetFontFamily(const StyleFontPaletteValuesRule *rule,
25568 nsACString *result);
25569
25570void Servo_FontPaletteValuesRule_GetBasePalette(const StyleFontPaletteValuesRule *rule,
25571 nsACString *result);
25572
25573void Servo_FontPaletteValuesRule_GetOverrideColors(const StyleFontPaletteValuesRule *rule,
25574 nsACString *result);
25575
25576StyleStrong<StyleLockedFontFaceRule> Servo_FontFaceRule_CreateEmpty();
25577
25578StyleStrong<StyleLockedFontFaceRule> Servo_FontFaceRule_Clone(const StyleLockedFontFaceRule *rule);
25579
25580void Servo_FontFaceRule_GetSourceLocation(const StyleLockedFontFaceRule *rule,
25581 uint32_t *line,
25582 uint32_t *column);
25583
25584uint32_t Servo_FontFaceRule_Length(const StyleLockedFontFaceRule *rule);
25585
25586nsCSSFontDesc Servo_FontFaceRule_IndexGetter(const StyleLockedFontFaceRule *rule,
25587 uint32_t index);
25588
25589void Servo_FontFaceRule_GetDeclCssText(const StyleLockedFontFaceRule *rule,
25590 nsACString *result);
25591
25592bool Servo_FontFaceRule_GetFontWeight(const StyleLockedFontFaceRule *rule,
25593 StyleComputedFontWeightRange *out);
25594
25595bool Servo_FontFaceRule_GetFontStretch(const StyleLockedFontFaceRule *rule,
25596 StyleComputedFontStretchRange *out);
25597
25598bool Servo_FontFaceRule_GetFontStyle(const StyleLockedFontFaceRule *rule,
25599 StyleComputedFontStyleDescriptor *out);
25600
25601bool Servo_FontFaceRule_GetFontDisplay(const StyleLockedFontFaceRule *rule,
25602 StyleFontDisplay *out);
25603
25604bool Servo_FontFaceRule_GetFontLanguageOverride(const StyleLockedFontFaceRule *rule,
25605 StyleFontLanguageOverride *out);
25606
25607bool Servo_FontFaceRule_GetAscentOverride(const StyleLockedFontFaceRule *rule,
25608 StylePercentage *out);
25609
25610bool Servo_FontFaceRule_GetDescentOverride(const StyleLockedFontFaceRule *rule,
25611 StylePercentage *out);
25612
25613bool Servo_FontFaceRule_GetLineGapOverride(const StyleLockedFontFaceRule *rule,
25614 StylePercentage *out);
25615
25616bool Servo_FontFaceRule_GetSizeAdjust(const StyleLockedFontFaceRule *rule,
25617 StylePercentage *out);
25618
25619nsAtom *Servo_FontFaceRule_GetFamilyName(const StyleLockedFontFaceRule *rule);
25620
25621const StyleUnicodeRange *Servo_FontFaceRule_GetUnicodeRanges(const StyleLockedFontFaceRule *rule,
25622 uintptr_t *out_len);
25623
25624void Servo_FontFaceRule_GetSources(const StyleLockedFontFaceRule *rule,
25625 nsTArray<StyleFontFaceSourceListComponent> *out);
25626
25627void Servo_FontFaceRule_GetVariationSettings(const StyleLockedFontFaceRule *rule,
25628 nsTArray<gfxFontVariation> *variations);
25629
25630void Servo_FontFaceRule_GetFeatureSettings(const StyleLockedFontFaceRule *rule,
25631 nsTArray<gfxFontFeature> *features);
25632
25633void Servo_FontFaceRule_GetDescriptorCssText(const StyleLockedFontFaceRule *rule,
25634 nsCSSFontDesc desc,
25635 nsACString *result);
25636
25637bool Servo_FontFaceRule_SetDescriptor(const StyleLockedFontFaceRule *rule,
25638 nsCSSFontDesc desc,
25639 const nsACString *value,
25640 URLExtraData *data,
25641 bool *out_changed);
25642
25643void Servo_FontFaceRule_ResetDescriptor(const StyleLockedFontFaceRule *rule,
25644 nsCSSFontDesc desc);
25645
25646nsAtom *Servo_CounterStyleRule_GetName(const StyleLockedCounterStyleRule *rule);
25647
25648bool Servo_CounterStyleRule_SetName(const StyleLockedCounterStyleRule *rule,
25649 const nsACString *value);
25650
25651uint32_t Servo_CounterStyleRule_GetGeneration(const StyleLockedCounterStyleRule *rule);
25652
25653bool Servo_CounterStyleRule_GetPad(const StyleLockedCounterStyleRule *rule,
25654 int32_t *width,
25655 nsString *symbol);
25656
25657bool Servo_CounterStyleRule_GetPrefix(const StyleLockedCounterStyleRule *rule,
25658 nsString *out);
25659
25660bool Servo_CounterStyleRule_GetSuffix(const StyleLockedCounterStyleRule *rule,
25661 nsString *out);
25662
25663bool Servo_CounterStyleRule_GetNegative(const StyleLockedCounterStyleRule *rule,
25664 nsString *prefix,
25665 nsString *suffix);
25666
25667StyleIsOrdinalInRange Servo_CounterStyleRule_IsInRange(const StyleLockedCounterStyleRule *rule,
25668 int32_t ordinal);
25669
25670const StyleSymbol *Servo_CounterStyleRule_GetSymbols(const StyleLockedCounterStyleRule *rule,
25671 uintptr_t *count);
25672
25673void Servo_CounterStyleRule_GetAdditiveSymbols(const StyleLockedCounterStyleRule *rule,
25674 StyleOwnedSlice<StyleAdditiveSymbol> *symbols);
25675
25676void Servo_CounterStyleRule_GetSpeakAs(const StyleLockedCounterStyleRule *rule,
25677 StyleCounterSpeakAs *out);
25678
25679StyleCounterSystem Servo_CounterStyleRule_GetSystem(const StyleLockedCounterStyleRule *rule);
25680
25681nsAtom *Servo_CounterStyleRule_GetExtended(const StyleLockedCounterStyleRule *rule);
25682
25683int32_t Servo_CounterStyleRule_GetFixedFirstValue(const StyleLockedCounterStyleRule *rule);
25684
25685nsAtom *Servo_CounterStyleRule_GetFallback(const StyleLockedCounterStyleRule *rule);
25686
25687void Servo_PositionTryRule_GetName(const StyleLockedPositionTryRule *rule,
25688 nsACString *result);
25689
25690StyleStrong<StyleLockedDeclarationBlock> Servo_PositionTryRule_GetStyle(const StyleLockedPositionTryRule *rule);
25691
25692void Servo_PositionTryRule_SetStyle(const StyleLockedPositionTryRule *rule,
25693 const StyleLockedDeclarationBlock *declarations);
25694
25695StyleStrong<StyleComputedValues> Servo_ComputedValues_GetForPageContent(const StylePerDocumentStyleData *raw_data,
25696 const nsAtom *page_name,
25697 StylePagePseudoClassFlags pseudos);
25698
25699StyleStrong<StyleComputedValues> Servo_ComputedValues_GetForAnonymousBox(const StyleComputedValues *parent_style_or_null,
25700 PseudoStyleType pseudo,
25701 const StylePerDocumentStyleData *raw_data);
25702
25703StyleStrong<StyleComputedValues> Servo_ResolvePseudoStyle(const StyleRawGeckoElement *element,
25704 PseudoStyleType pseudo_type,
25705 nsAtom *functional_pseudo_parameter,
25706 bool is_probe,
25707 const StyleComputedValues *inherited_style,
25708 const StylePerDocumentStyleData *raw_data);
25709
25710StyleStrong<StyleComputedValues> Servo_ComputedValues_ResolveXULTreePseudoStyle(const StyleRawGeckoElement *element,
25711 nsAtom *pseudo_tag,
25712 const StyleComputedValues *inherited_style,
25713 const nsTArray<RefPtr<nsAtom>> *input_word,
25714 const StylePerDocumentStyleData *raw_data);
25715
25716void Servo_SetExplicitStyle(const StyleRawGeckoElement *element,
25717 const StyleComputedValues *style);
25718
25719StyleStrong<StyleComputedValues> Servo_ComputedValues_Inherit(const StylePerDocumentStyleData *raw_data,
25720 PseudoStyleType pseudo,
25721 const StyleComputedValues *parent_style_context,
25722 InheritTarget target);
25723
25724bool Servo_ComputedValues_SpecifiesAnimationsOrTransitions(const StyleComputedValues *values);
25725
25726void Servo_ComputedValues_GetMatchingDeclarations(const StyleComputedValues *values,
25727 nsTArray<const StyleLockedDeclarationBlock*> *rules);
25728
25729bool Servo_ComputedValues_EqualForCachedAnonymousContentStyle(const StyleComputedValues *a,
25730 const StyleComputedValues *b);
25731
25732void Servo_ComputedValues_DumpMatchedRules(const StyleComputedValues *s);
25733
25734uint16_t Servo_ComputedValues_BlockifiedDisplay(const StyleComputedValues *style,
25735 bool is_root_element);
25736
25737StylePerDocumentStyleData *Servo_StyleSet_Init(const StyleDocument *doc);
25738
25739void Servo_StyleSet_Drop(StylePerDocumentStyleData *data);
25740
25741void Servo_StyleSet_RebuildCachedData(const StylePerDocumentStyleData *raw_data);
25742
25743void Servo_StyleSet_CompatModeChanged(const StylePerDocumentStyleData *raw_data);
25744
25745StyleStrong<StyleLockedDeclarationBlock> Servo_ParseProperty(const AnimatedPropertyID *property,
25746 const nsACString *value,
25747 URLExtraData *data,
25748 StyleParsingMode parsing_mode,
25749 nsCompatibility quirks_mode,
25750 StyleLoader *loader,
25751 StyleCssRuleType rule_type);
25752
25753bool Servo_ParseEasing(const nsACString *easing,
25754 StyleComputedTimingFunction *output);
25755
25756void Servo_SerializeEasing(const StyleComputedTimingFunction *easing,
25757 nsACString *output);
25758
25759void Servo_GetProperties_Overriding_Animation(const StyleRawGeckoElement *element,
25760 const nsTArray<nsCSSPropertyID> *list,
25761 nsCSSPropertyIDSet *set);
25762
25763void Servo_MatrixTransform_Operate(bool interpolate,
25764 const StyleMatrix4x4Components *from,
25765 const StyleMatrix4x4Components *to,
25766 double progress,
25767 StyleMatrix4x4Components *output);
25768
25769StyleStrong<StyleLockedDeclarationBlock> Servo_ParseStyleAttribute(const nsACString *data,
25770 URLExtraData *raw_extra_data,
25771 nsCompatibility quirks_mode,
25772 StyleLoader *loader,
25773 StyleCssRuleType rule_type);
25774
25775StyleStrong<StyleLockedDeclarationBlock> Servo_DeclarationBlock_CreateEmpty();
25776
25777void Servo_DeclarationBlock_Clear(const StyleLockedDeclarationBlock *declarations);
25778
25779StyleStrong<StyleLockedDeclarationBlock> Servo_DeclarationBlock_Clone(const StyleLockedDeclarationBlock *declarations);
25780
25781bool Servo_DeclarationBlock_Equals(const StyleLockedDeclarationBlock *a,
25782 const StyleLockedDeclarationBlock *b);
25783
25784void Servo_DeclarationBlock_GetCssText(const StyleLockedDeclarationBlock *declarations,
25785 nsACString *result);
25786
25787void Servo_DeclarationBlock_SerializeOneValue(const StyleLockedDeclarationBlock *decls,
25788 const AnimatedPropertyID *property_id,
25789 nsACString *buffer,
25790 const StyleComputedValues *computed_values,
25791 const StylePerDocumentStyleData *data);
25792
25793void Servo_SerializeFontValueForCanvas(const StyleLockedDeclarationBlock *declarations,
25794 nsACString *buffer);
25795
25796uint32_t Servo_DeclarationBlock_Count(const StyleLockedDeclarationBlock *declarations);
25797
25798bool Servo_DeclarationBlock_GetNthProperty(const StyleLockedDeclarationBlock *declarations,
25799 uint32_t index,
25800 nsACString *result);
25801
25802void Servo_DeclarationBlock_GetPropertyValue(const StyleLockedDeclarationBlock *declarations,
25803 const nsACString *property,
25804 nsACString *value);
25805
25806void Servo_DeclarationBlock_GetPropertyValueById(const StyleLockedDeclarationBlock *declarations,
25807 nsCSSPropertyID property,
25808 nsACString *value);
25809
25810bool Servo_DeclarationBlock_GetPropertyIsImportant(const StyleLockedDeclarationBlock *declarations,
25811 const nsACString *property);
25812
25813void Servo_DeclarationBlock_SanitizeForCanvas(const StyleLockedDeclarationBlock *declarations);
25814
25815bool Servo_DeclarationBlock_SetProperty(const StyleLockedDeclarationBlock *declarations,
25816 const nsACString *property,
25817 const nsACString *value,
25818 bool is_important,
25819 URLExtraData *data,
25820 StyleParsingMode parsing_mode,
25821 nsCompatibility quirks_mode,
25822 StyleLoader *loader,
25823 StyleCssRuleType rule_type,
25824 DeclarationBlockMutationClosure before_change_closure);
25825
25826bool Servo_DeclarationBlock_SetPropertyToAnimationValue(const StyleLockedDeclarationBlock *declarations,
25827 const StyleAnimationValue *animation_value,
25828 DeclarationBlockMutationClosure before_change_closure);
25829
25830bool Servo_DeclarationBlock_SetPropertyById(const StyleLockedDeclarationBlock *declarations,
25831 nsCSSPropertyID property,
25832 const nsACString *value,
25833 bool is_important,
25834 URLExtraData *data,
25835 StyleParsingMode parsing_mode,
25836 nsCompatibility quirks_mode,
25837 StyleLoader *loader,
25838 StyleCssRuleType rule_type,
25839 DeclarationBlockMutationClosure before_change_closure);
25840
25841bool Servo_DeclarationBlock_RemoveProperty(const StyleLockedDeclarationBlock *declarations,
25842 const nsACString *property,
25843 DeclarationBlockMutationClosure before_change_closure);
25844
25845bool Servo_DeclarationBlock_RemovePropertyById(const StyleLockedDeclarationBlock *declarations,
25846 nsCSSPropertyID property,
25847 DeclarationBlockMutationClosure before_change_closure);
25848
25849StyleStrong<StyleLockedMediaList> Servo_MediaList_Create();
25850
25851StyleStrong<StyleLockedMediaList> Servo_MediaList_DeepClone(const StyleLockedMediaList *list);
25852
25853bool Servo_MediaList_Matches(const StyleLockedMediaList *list,
25854 const StylePerDocumentStyleData *raw_data);
25855
25856bool Servo_DeclarationBlock_HasCSSWideKeyword(const StyleLockedDeclarationBlock *declarations,
25857 nsCSSPropertyID property);
25858
25859void Servo_MediaList_GetText(const StyleLockedMediaList *list,
25860 nsACString *result);
25861
25862void Servo_MediaList_SetText(const StyleLockedMediaList *list,
25863 const nsACString *text,
25864 StyleCallerType caller_type);
25865
25866bool Servo_MediaList_IsViewportDependent(const StyleLockedMediaList *list);
25867
25868uint32_t Servo_MediaList_GetLength(const StyleLockedMediaList *list);
25869
25870bool Servo_MediaList_GetMediumAt(const StyleLockedMediaList *list,
25871 uint32_t index,
25872 nsACString *result);
25873
25874void Servo_MediaList_AppendMedium(const StyleLockedMediaList *list,
25875 const nsACString *new_medium);
25876
25877bool Servo_MediaList_DeleteMedium(const StyleLockedMediaList *list,
25878 const nsACString *old_medium);
25879
25880uintptr_t Servo_MediaList_SizeOfIncludingThis(StyleGeckoMallocSizeOf malloc_size_of,
25881 StyleGeckoMallocSizeOf malloc_enclosing_size_of,
25882 const StyleLockedMediaList *list);
25883
25884bool Servo_DeclarationBlock_PropertyIsSet(const StyleLockedDeclarationBlock *declarations,
25885 nsCSSPropertyID property);
25886
25887void Servo_DeclarationBlock_SetIdentStringValue(const StyleLockedDeclarationBlock *declarations,
25888 nsCSSPropertyID property,
25889 nsAtom *value);
25890
25891void Servo_DeclarationBlock_SetKeywordValue(const StyleLockedDeclarationBlock *declarations,
25892 nsCSSPropertyID property,
25893 int32_t value);
25894
25895void Servo_DeclarationBlock_SetIntValue(const StyleLockedDeclarationBlock *declarations,
25896 nsCSSPropertyID property,
25897 int32_t value);
25898
25899void Servo_DeclarationBlock_SetMathDepthValue(const StyleLockedDeclarationBlock *declarations,
25900 int32_t value,
25901 bool is_relative);
25902
25903void Servo_DeclarationBlock_SetCounterResetListItem(const StyleLockedDeclarationBlock *declarations,
25904 int32_t counter_value,
25905 bool is_reversed);
25906
25907void Servo_DeclarationBlock_SetCounterSetListItem(const StyleLockedDeclarationBlock *declarations,
25908 int32_t counter_value);
25909
25910void Servo_DeclarationBlock_SetPixelValue(const StyleLockedDeclarationBlock *declarations,
25911 nsCSSPropertyID property,
25912 float value);
25913
25914void Servo_DeclarationBlock_SetLengthValue(const StyleLockedDeclarationBlock *declarations,
25915 nsCSSPropertyID property,
25916 float value,
25917 nsCSSUnit unit);
25918
25919void Servo_DeclarationBlock_SetTransform(const StyleLockedDeclarationBlock *declarations,
25920 nsCSSPropertyID property,
25921 const nsTArray<StyleTransformOperation> *ops);
25922
25923void Servo_DeclarationBlock_SetPathValue(const StyleLockedDeclarationBlock *declarations,
25924 nsCSSPropertyID property,
25925 const StyleSVGPathData *path);
25926
25927void Servo_CreatePathDataFromCommands(nsTArray<StylePathCommand> *path_commands,
25928 StyleSVGPathData *dest);
25929
25930bool Servo_SVGPathData_Add(StyleSVGPathData *dest,
25931 const StyleSVGPathData *to_add,
25932 uint32_t count);
25933
25934bool Servo_SVGPathData_Parse(const nsACString *input, StyleSVGPathData *dest);
25935
25936void Servo_SVGPathData_NormalizeAndReduce(const StyleSVGPathData *input,
25937 StyleSVGPathData *dest);
25938
25939void Servo_SVGPathData_ToString(const StyleSVGPathData *path, nsACString *dest);
25940
25941bool Servo_SVGPathData_Interpolate(const StyleSVGPathData *left,
25942 const StyleSVGPathData *right,
25943 double progress,
25944 StyleSVGPathData *dest);
25945
25946void Servo_DeclarationBlock_SetPercentValue(const StyleLockedDeclarationBlock *declarations,
25947 nsCSSPropertyID property,
25948 float value);
25949
25950void Servo_DeclarationBlock_SetAutoValue(const StyleLockedDeclarationBlock *declarations,
25951 nsCSSPropertyID property);
25952
25953void Servo_DeclarationBlock_SetCurrentColor(const StyleLockedDeclarationBlock *declarations,
25954 nsCSSPropertyID property);
25955
25956void Servo_DeclarationBlock_SetColorValue(const StyleLockedDeclarationBlock *declarations,
25957 nsCSSPropertyID property,
25958 nscolor value);
25959
25960void Servo_DeclarationBlock_SetFontFamily(const StyleLockedDeclarationBlock *declarations,
25961 const nsACString *value);
25962
25963void Servo_DeclarationBlock_SetBackgroundImage(const StyleLockedDeclarationBlock *declarations,
25964 const nsACString *value,
25965 URLExtraData *raw_extra_data);
25966
25967void Servo_DeclarationBlock_SetTextDecorationColorOverride(const StyleLockedDeclarationBlock *declarations);
25968
25969void Servo_DeclarationBlock_SetAspectRatio(const StyleLockedDeclarationBlock *declarations,
25970 float width,
25971 float height);
25972
25973bool Servo_CSSSupports2(const nsACString *property, const nsACString *value);
25974
25975bool Servo_CSSSupports(const nsACString *cond,
25976 bool ua_origin,
25977 bool chrome_sheet,
25978 bool quirks);
25979
25980bool Servo_CSSSupportsForImport(const nsACString *after_rule);
25981
25982void Servo_NoteExplicitHints(const StyleRawGeckoElement *element,
25983 StyleRestyleHint restyle_hint,
25984 nsChangeHint change_hint);
25985
25986uint32_t Servo_TakeChangeHint(const StyleRawGeckoElement *element,
25987 bool *was_restyled);
25988
25989StyleStrong<StyleComputedValues> Servo_ResolveStyle(const StyleRawGeckoElement *element);
25990
25991StyleStrong<StyleComputedValues> Servo_ResolveStyleLazily(const StyleRawGeckoElement *element,
25992 PseudoStyleType pseudo_type,
25993 nsAtom *functional_pseudo_parameter,
25994 StyleRuleInclusion rule_inclusion,
25995 const ServoElementSnapshotTable *snapshots,
25996 uint64_t cache_generation,
25997 bool can_use_cache,
25998 const StylePerDocumentStyleData *raw_data);
25999
26000StyleStrong<StyleComputedValues> Servo_ResolveStartingStyle(const StyleRawGeckoElement *element,
26001 const ServoElementSnapshotTable *snapshots,
26002 const StylePerDocumentStyleData *raw_data);
26003
26004StyleStrong<StyleComputedValues> Servo_ReparentStyle(const StyleComputedValues *style_to_reparent,
26005 const StyleComputedValues *parent_style,
26006 const StyleComputedValues *layout_parent_style,
26007 const StyleRawGeckoElement *element,
26008 const StylePerDocumentStyleData *raw_data);
26009
26010void Servo_GetComputedKeyframeValues(const nsTArray<Keyframe> *keyframes,
26011 const StyleRawGeckoElement *element,
26012 PseudoStyleType pseudo_type,
26013 const StyleComputedValues *style,
26014 const StylePerDocumentStyleData *raw_data,
26015 nsTArray<ComputedKeyframeValues> *computed_keyframes);
26016
26017void Servo_GetAnimationValues(const StyleLockedDeclarationBlock *declarations,
26018 const StyleRawGeckoElement *element,
26019 const StyleComputedValues *style,
26020 const StylePerDocumentStyleData *raw_data,
26021 nsTArray<RefPtr<StyleAnimationValue>> *animation_values);
26022
26023void Servo_AnimationValue_GetPropertyId(const StyleAnimationValue *value,
26024 AnimatedPropertyID *property_id);
26025
26026StyleStrong<StyleAnimationValue> Servo_AnimationValue_Compute(const StyleRawGeckoElement *element,
26027 const StyleLockedDeclarationBlock *declarations,
26028 const StyleComputedValues *style,
26029 const StylePerDocumentStyleData *raw_data);
26030
26031void Servo_AssertTreeIsClean(const StyleRawGeckoElement *root);
26032
26033bool Servo_IsWorkerThread();
26034
26035bool Servo_StyleSet_GetKeyframesForName(const StylePerDocumentStyleData *raw_data,
26036 const StyleRawGeckoElement *element,
26037 const StyleComputedValues *style,
26038 nsAtom *name,
26039 const StyleComputedTimingFunction *inherited_timing_function,
26040 nsTArray<Keyframe> *keyframes);
26041
26042void Servo_StyleSet_GetFontFaceRules(const StylePerDocumentStyleData *raw_data,
26043 nsTArray<nsFontFaceRuleContainer> *rules);
26044
26045const StyleLockedCounterStyleRule *Servo_StyleSet_GetCounterStyleRule(const StylePerDocumentStyleData *raw_data,
26046 nsAtom *name);
26047
26048gfxFontFeatureValueSet *Servo_StyleSet_BuildFontFeatureValueSet(const StylePerDocumentStyleData *raw_data);
26049
26050gfx::FontPaletteValueSet *Servo_StyleSet_BuildFontPaletteValueSet(const StylePerDocumentStyleData *raw_data);
26051
26052StyleStrong<StyleComputedValues> Servo_StyleSet_ResolveForDeclarations(const StylePerDocumentStyleData *raw_data,
26053 const StyleComputedValues *parent_style_context,
26054 const StyleLockedDeclarationBlock *declarations);
26055
26056void Servo_StyleSet_AddSizeOfExcludingThis(StyleGeckoMallocSizeOf malloc_size_of,
26057 StyleGeckoMallocSizeOf malloc_enclosing_size_of,
26058 ServoStyleSetSizes *sizes,
26059 const StylePerDocumentStyleData *raw_data);
26060
26061void Servo_UACache_AddSizeOf(StyleGeckoMallocSizeOf malloc_size_of,
26062 StyleGeckoMallocSizeOf malloc_enclosing_size_of,
26063 ServoStyleSetSizes *sizes);
26064
26065bool Servo_StyleSet_MightHaveAttributeDependency(const StylePerDocumentStyleData *raw_data,
26066 const StyleRawGeckoElement *element,
26067 nsAtom *local_name);
26068
26069bool Servo_StyleSet_MightHaveNthOfIDDependency(const StylePerDocumentStyleData *raw_data,
26070 const StyleRawGeckoElement *element,
26071 nsAtom *old_id,
26072 nsAtom *new_id);
26073
26074bool Servo_StyleSet_MightHaveNthOfClassDependency(const StylePerDocumentStyleData *raw_data,
26075 const StyleRawGeckoElement *element,
26076 const ServoElementSnapshotTable *snapshots);
26077
26078bool Servo_StyleSet_MightHaveNthOfAttributeDependency(const StylePerDocumentStyleData *raw_data,
26079 const StyleRawGeckoElement *element,
26080 nsAtom *local_name);
26081
26082void Servo_StyleSet_MaybeInvalidateRelativeSelectorIDDependency(const StylePerDocumentStyleData *raw_data,
26083 const StyleRawGeckoElement *element,
26084 nsAtom *old_id,
26085 nsAtom *new_id,
26086 const ServoElementSnapshotTable *snapshots);
26087
26088void Servo_StyleSet_MaybeInvalidateRelativeSelectorClassDependency(const StylePerDocumentStyleData *raw_data,
26089 const StyleRawGeckoElement *element,
26090 const ServoElementSnapshotTable *snapshots);
26091
26092void Servo_StyleSet_MaybeInvalidateRelativeSelectorAttributeDependency(const StylePerDocumentStyleData *raw_data,
26093 const StyleRawGeckoElement *element,
26094 nsAtom *local_name,
26095 const ServoElementSnapshotTable *snapshots);
26096
26097void Servo_StyleSet_MaybeInvalidateRelativeSelectorStateDependency(const StylePerDocumentStyleData *raw_data,
26098 const StyleRawGeckoElement *element,
26099 uint64_t state,
26100 const ServoElementSnapshotTable *snapshots);
26101
26102void Servo_StyleSet_MaybeInvalidateRelativeSelectorCustomStateDependency(const StylePerDocumentStyleData *raw_data,
26103 const StyleRawGeckoElement *element,
26104 nsAtom *state,
26105 const ServoElementSnapshotTable *snapshots);
26106
26107void Servo_StyleSet_MaybeInvalidateRelativeSelectorEmptyDependency(const StylePerDocumentStyleData *raw_data,
26108 const StyleRawGeckoElement *element);
26109
26110void Servo_StyleSet_MaybeInvalidateRelativeSelectorNthEdgeDependency(const StylePerDocumentStyleData *raw_data,
26111 const StyleRawGeckoElement *element,
26112 StyleRelativeSelectorNthEdgeInvalidateFor invalidate_for);
26113
26114void Servo_StyleSet_MaybeInvalidateRelativeSelectorNthDependencyFromSibling(const StylePerDocumentStyleData *raw_data,
26115 const StyleRawGeckoElement *element,
26116 bool force);
26117
26118void Servo_StyleSet_MaybeInvalidateRelativeSelectorForInsertion(const StylePerDocumentStyleData *raw_data,
26119 const StyleRawGeckoElement *element);
26120
26121void Servo_StyleSet_MaybeInvalidateRelativeSelectorForAppend(const StylePerDocumentStyleData *raw_data,
26122 const StyleRawGeckoNode *first_node);
26123
26124void Servo_StyleSet_MaybeInvalidateRelativeSelectorForRemoval(const StylePerDocumentStyleData *raw_data,
26125 const StyleRawGeckoElement *element);
26126
26127bool Servo_StyleSet_HasStateDependency(const StylePerDocumentStyleData *raw_data,
26128 const StyleRawGeckoElement *element,
26129 uint64_t state);
26130
26131bool Servo_StyleSet_HasNthOfCustomStateDependency(const StylePerDocumentStyleData *raw_data,
26132 const StyleRawGeckoElement *element,
26133 nsAtom *state);
26134
26135bool Servo_StyleSet_HasNthOfStateDependency(const StylePerDocumentStyleData *raw_data,
26136 const StyleRawGeckoElement *element,
26137 uint64_t state);
26138
26139void Servo_StyleSet_RestyleSiblingsForNthOf(const StyleRawGeckoElement *element,
26140 uint32_t flags);
26141
26142bool Servo_StyleSet_HasDocumentStateDependency(const StylePerDocumentStyleData *raw_data,
26143 uint64_t state);
26144
26145void Servo_GetComputedValue(const StyleComputedValues *style,
26146 nsCSSPropertyID prop,
26147 nsACString *value);
26148
26149void Servo_GetResolvedValue(const StyleComputedValues *style,
26150 nsCSSPropertyID prop,
26151 const StylePerDocumentStyleData *raw_data,
26152 const StyleRawGeckoElement *element,
26153 nsACString *value);
26154
26155bool Servo_GetCustomPropertyValue(const StyleComputedValues *style,
26156 const nsACString *name,
26157 const StylePerDocumentStyleData *raw_data,
26158 nsACString *value);
26159
26160uint32_t Servo_GetCustomPropertiesCount(const StyleComputedValues *computed_values);
26161
26162nsAtom *Servo_GetCustomPropertyNameAt(const StyleComputedValues *computed_values,
26163 uint32_t index);
26164
26165bool Servo_CssUrl_IsLocalRef(const StyleCssUrl *url);
26166
26167void Servo_ProcessInvalidations(const StylePerDocumentStyleData *set,
26168 const StyleRawGeckoElement *element,
26169 const ServoElementSnapshotTable *snapshots);
26170
26171bool Servo_HasPendingRestyleAncestor(const StyleRawGeckoElement *element,
26172 bool may_need_to_flush_layout);
26173
26174StyleSelectorList *Servo_SelectorList_Parse(const nsACString *selector_list,
26175 bool is_chrome);
26176
26177void Servo_SelectorList_Drop(StyleSelectorList *list);
26178
26179bool Servo_IsValidCSSColor(const nsACString *value);
26180
26181bool Servo_ComputeColor(const StylePerDocumentStyleData *raw_data,
26182 nscolor current_color,
26183 const nsACString *value,
26184 nscolor *result_color,
26185 bool *was_current_color,
26186 StyleLoader *loader);
26187
26188bool Servo_ColorTo(const nsACString *from_color,
26189 const nsACString *to_color_space,
26190 nsACString *result_color,
26191 nsTArray<float> *result_components,
26192 bool *result_adjusted,
26193 StyleLoader *loader);
26194
26195StyleAbsoluteColor Servo_ResolveColor(const StyleColor *color,
26196 const StyleAbsoluteColor *foreground);
26197
26198float Servo_ResolveCalcLengthPercentage(const StyleCalcLengthPercentage *calc,
26199 float basis);
26200
26201StyleAbsoluteColor Servo_ConvertColorSpace(const StyleAbsoluteColor *color,
26202 StyleColorSpace color_space);
26203
26204bool Servo_IntersectionObserverRootMargin_Parse(const nsACString *value,
26205 StyleIntersectionObserverRootMargin *result);
26206
26207void Servo_IntersectionObserverRootMargin_ToString(const StyleIntersectionObserverRootMargin *root_margin,
26208 nsACString *result);
26209
26210bool Servo_ParseTransformIntoMatrix(const nsACString *value,
26211 bool *contain_3d,
26212 StyleMatrix4x4Components *result);
26213
26214bool Servo_ParseFilters(const nsACString *value,
26215 bool ignore_urls,
26216 URLExtraData *data,
26217 StyleOwnedSlice<StyleFilter> *out);
26218
26219bool Servo_ParseFontShorthandForMatching(const nsACString *value,
26220 URLExtraData *data,
26221 StyleFontFamilyList *family,
26222 StyleFontStyle *style,
26223 StyleFontStretch *stretch,
26224 StyleFontWeight *weight,
26225 float *size,
26226 bool *small_caps);
26227
26228StyleSourceSizeList *Servo_SourceSizeList_Parse(const nsACString *value);
26229
26230int32_t Servo_SourceSizeList_Evaluate(const StylePerDocumentStyleData *raw_data,
26231 const StyleSourceSizeList *list);
26232
26233void Servo_SourceSizeList_Drop(StyleSourceSizeList *list);
26234
26235void Servo_InvalidateStyleForDocStateChanges(const StyleRawGeckoElement *root,
26236 const StylePerDocumentStyleData *document_style,
26237 const nsTArray<const StyleAuthorStyles*> *non_document_styles,
26238 uint64_t states_changed);
26239
26240uint64_t Servo_PseudoClass_GetStates(const nsACString *name);
26241
26242StyleUseCounters *Servo_UseCounters_Create();
26243
26244void Servo_UseCounters_Drop(StyleUseCounters *c);
26245
26246void Servo_UseCounters_Merge(const StyleUseCounters *doc_counters,
26247 const StyleUseCounters *sheet_counters);
26248
26249bool Servo_IsPropertyIdRecordedInUseCounter(const StyleUseCounters *use_counters,
26250 nsCSSPropertyID id);
26251
26252bool Servo_IsUnknownPropertyRecordedInUseCounter(const StyleUseCounters *use_counters,
26253 CountedUnknownProperty p);
26254
26255bool Servo_IsCssPropertyRecordedInUseCounter(const StyleUseCounters *use_counters,
26256 const nsACString *property,
26257 bool *known_prop);
26258
26259StyleSharedMemoryBuilder *Servo_SharedMemoryBuilder_Create(uint8_t *buffer,
26260 uintptr_t len);
26261
26262const StyleLockedCssRules *Servo_SharedMemoryBuilder_AddStylesheet(StyleSharedMemoryBuilder *builder,
26263 const StyleStylesheetContents *contents,
26264 nsACString *error_message);
26265
26266uintptr_t Servo_SharedMemoryBuilder_GetLength(const StyleSharedMemoryBuilder *builder);
26267
26268void Servo_SharedMemoryBuilder_Drop(StyleSharedMemoryBuilder *builder);
26269
26270void *Servo_StyleArcSlice_EmptyPtr();
26271
26272const StyleLoadData *Servo_LoadData_GetLazy(const StyleLoadDataSource *source);
26273
26274void Servo_LengthPercentage_ToCss(const StyleLengthPercentage *lp,
26275 nsACString *result);
26276
26277void Servo_FontStyle_ToCss(const StyleFontStyle *s, nsACString *result);
26278
26279void Servo_FontWeight_ToCss(const StyleFontWeight *w, nsACString *result);
26280
26281void Servo_FontStretch_ToCss(const StyleFontStretch *s, nsACString *result);
26282
26283bool Servo_FontStretch_SerializeKeyword(const StyleFontStretch *s,
26284 nsACString *result);
26285
26286bool Servo_CursorKind_Parse(const nsACString *cursor, StyleCursorKind *result);
26287
26288const StyleFontFamily *Servo_FontFamily_Generic(StyleGenericFontFamily generic);
26289
26290void Servo_FontFamily_ForSystemFont(const nsACString *name,
26291 StyleFontFamily *out);
26292
26293void Servo_FontFamilyList_WithNames(const nsTArray<StyleSingleFontFamily> *names,
26294 StyleFontFamilyList *out);
26295
26296void Servo_FamilyName_Serialize(const StyleFamilyName *name,
26297 nsACString *result);
26298
26299StyleGenericFontFamily Servo_GenericFontFamily_Parse(const nsACString *input);
26300
26301bool Servo_ColorScheme_Parse(const nsACString *input, uint8_t *out);
26302
26303void Servo_LayerBlockRule_GetName(const StyleLayerBlockRule *rule,
26304 nsACString *result);
26305
26306void Servo_ScopeRule_GetStart(const StyleScopeRule *rule, nsACString *result);
26307
26308void Servo_ScopeRule_GetEnd(const StyleScopeRule *rule, nsACString *result);
26309
26310uintptr_t Servo_LayerStatementRule_GetNameCount(const StyleLayerStatementRule *rule);
26311
26312void Servo_LayerStatementRule_GetNameAt(const StyleLayerStatementRule *rule,
26313 uintptr_t index,
26314 nsACString *result);
26315
26316void Servo_InvalidateForViewportUnits(const StylePerDocumentStyleData *document_style,
26317 const StyleRawGeckoElement *root,
26318 bool dynamic_only);
26319
26320StyleAbsoluteColor Servo_InterpolateColor(StyleColorInterpolationMethod interpolation,
26321 const StyleAbsoluteColor *start_color,
26322 const StyleAbsoluteColor *end_color,
26323 float progress);
26324
26325double Servo_EasingFunctionAt(const StyleComputedTimingFunction *easing_function,
26326 double progress,
26327 StyleEasingBeforeFlag before_flag);
26328
26329bool Servo_ParseLengthWithoutStyleContext(const nsACString *len,
26330 float *out,
26331 GeckoFontMetrics (*get_font_metrics)(void*),
26332 void *getter_context);
26333
26334bool Servo_SlowRgbToColorName(uint8_t r,
26335 uint8_t g,
26336 uint8_t b,
26337 nsACString *result);
26338
26339bool Servo_ColorNameToRgb(const nsACString *name, nscolor *out);
26340
26341/// https://drafts.css-houdini.org/css-properties-values-api-1/#the-registerproperty-function
26342StyleRegisterCustomPropertyResult Servo_RegisterCustomProperty(const StylePerDocumentStyleData *per_doc_data,
26343 URLExtraData *extra_data,
26344 const nsACString *name,
26345 const nsACString *syntax,
26346 bool inherits,
26347 const nsACString *initial_value);
26348
26349void Servo_GetRegisteredCustomProperties(const StylePerDocumentStyleData *per_doc_data,
26350 nsTArray<StylePropDef> *custom_properties);
26351
26352bool Servo_GetRegisteredCustomProperty(const StylePerDocumentStyleData *per_doc_data,
26353 const nsACString *name,
26354 StylePropDef *custom_property);
26355
26356bool Servo_Value_Matches_Syntax(const nsACString *value,
26357 const nsACString *syntax,
26358 URLExtraData *extra_data);
26359
26360void Servo_GetSelectorWarnings(const StyleLockedStyleRule *rule,
26361 nsTArray<StyleSelectorWarningData> *warnings);
26362
26363void Servo_GetRuleBodyText(const nsACString *initial_text, nsACString *ret_val);
26364
26365void Servo_ReplaceBlockRuleBodyTextInStylesheetText(const nsACString *stylesheet_text,
26366 uint32_t line,
26367 uint32_t column,
26368 const nsACString *new_body_text,
26369 nsACString *ret_val);
26370
26371StyleParserState *Servo_CSSParser_create(const nsACString *text);
26372
26373void Servo_CSSParser_destroy(StyleParserState *state);
26374
26375uint32_t Servo_CSSParser_GetCurrentLine(const StyleParserState *state);
26376
26377uint32_t Servo_CSSParser_GetCurrentColumn(const StyleParserState *state);
26378
26379bool Servo_CSSParser_NextToken(const nsACString *text,
26380 StyleParserState *state,
26381 StyleCSSToken *css_token);
26382
26383} // extern "C"
26384
26385} // namespace mozilla
26386
26387#pragma pop_macro("STRICT")
26388#pragma pop_macro("TRANSPARENT")
26389
26390#endif // mozilla_ServoStyleConsts_h
26391
26392#pragma GCC diagnostic pop
26393#include "mozilla/ServoStyleConstsInlines.h"

/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h

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/* Some inline functions declared in cbindgen.toml */
8
9#ifndef mozilla_ServoStyleConstsInlines_h
10#define mozilla_ServoStyleConstsInlines_h
11
12#include "mozilla/ServoStyleConsts.h"
13#include "mozilla/AspectRatio.h"
14#include "mozilla/EndianUtils.h"
15#include "mozilla/URLExtraData.h"
16#include "mozilla/dom/WorkerCommon.h"
17#include "nsGkAtoms.h"
18#include "MainThreadUtils.h"
19#include "nsNetUtil.h"
20#include <type_traits>
21#include <new>
22
23// TODO(emilio): there are quite a few other implementations scattered around
24// that should move here.
25
26namespace mozilla {
27
28// We need to explicitly instantiate these so that the clang plugin can see that
29// they're trivially copyable...
30//
31// https://github.com/eqrion/cbindgen/issues/402 tracks doing something like
32// this automatically from cbindgen.
33template struct StyleStrong<ComputedStyle>;
34template struct StyleStrong<StyleLockedCssRules>;
35template struct StyleStrong<StyleAnimationValue>;
36template struct StyleStrong<StyleLockedDeclarationBlock>;
37template struct StyleStrong<StyleStylesheetContents>;
38template struct StyleStrong<StyleLockedKeyframe>;
39template struct StyleStrong<StyleLayerBlockRule>;
40template struct StyleStrong<StyleLayerStatementRule>;
41template struct StyleStrong<StyleLockedMediaList>;
42template struct StyleStrong<StyleLockedStyleRule>;
43template struct StyleStrong<StyleLockedImportRule>;
44template struct StyleStrong<StyleLockedKeyframesRule>;
45template struct StyleStrong<StyleMediaRule>;
46template struct StyleStrong<StyleDocumentRule>;
47template struct StyleStrong<StyleNamespaceRule>;
48template struct StyleStrong<StyleMarginRule>;
49template struct StyleStrong<StyleLockedPageRule>;
50template struct StyleStrong<StylePropertyRule>;
51template struct StyleStrong<StyleSupportsRule>;
52template struct StyleStrong<StyleFontFeatureValuesRule>;
53template struct StyleStrong<StyleFontPaletteValuesRule>;
54template struct StyleStrong<StyleLockedFontFaceRule>;
55template struct StyleStrong<StyleLockedCounterStyleRule>;
56template struct StyleStrong<StyleContainerRule>;
57template struct StyleStrong<StyleScopeRule>;
58template struct StyleStrong<StyleStartingStyleRule>;
59template struct StyleStrong<StyleLockedPositionTryRule>;
60template struct StyleStrong<StyleLockedNestedDeclarationsRule>;
61
62template <typename T>
63inline void StyleOwnedSlice<T>::Clear() {
64 if (!len) {
65 return;
66 }
67 for (size_t i : IntegerRange(len)) {
68 ptr[i].~T();
69 }
70 free(ptr);
71 ptr = (T*)alignof(T);
72 len = 0;
73}
74
75template <typename T>
76inline void StyleOwnedSlice<T>::CopyFrom(const StyleOwnedSlice& aOther) {
77 Clear();
78 len = aOther.len;
79 if (!len) {
80 ptr = (T*)alignof(T);
81 } else {
82 ptr = (T*)malloc(len * sizeof(T));
83 size_t i = 0;
84 for (const T& elem : aOther.AsSpan()) {
85 new (ptr + i++) T(elem);
86 }
87 }
88}
89
90template <typename T>
91inline void StyleOwnedSlice<T>::SwapElements(StyleOwnedSlice& aOther) {
92 std::swap(ptr, aOther.ptr);
93 std::swap(len, aOther.len);
94}
95
96template <typename T>
97inline StyleOwnedSlice<T>::StyleOwnedSlice(const StyleOwnedSlice& aOther)
98 : StyleOwnedSlice() {
99 CopyFrom(aOther);
100}
101
102template <typename T>
103inline StyleOwnedSlice<T>::StyleOwnedSlice(StyleOwnedSlice&& aOther)
104 : StyleOwnedSlice() {
105 SwapElements(aOther);
106}
107
108template <typename T>
109inline StyleOwnedSlice<T>::StyleOwnedSlice(Vector<T>&& aVector)
110 : StyleOwnedSlice() {
111 if (!aVector.length()) {
112 return;
113 }
114
115 // We could handle this if Vector provided the relevant APIs, see bug 1610702.
116 MOZ_DIAGNOSTIC_ASSERT(aVector.length() == aVector.capacity(),do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aVector.length() == aVector.capacity())>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(aVector.length() == aVector.capacity()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("aVector.length() == aVector.capacity()"
" (" "Shouldn't over-allocate" ")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 117); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "aVector.length() == aVector.capacity()"
") (" "Shouldn't over-allocate" ")"); do { *((volatile int*)
__null) = 117; __attribute__((nomerge)) ::abort(); } while (false
); } } while (false)
117 "Shouldn't over-allocate")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aVector.length() == aVector.capacity())>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(aVector.length() == aVector.capacity()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("aVector.length() == aVector.capacity()"
" (" "Shouldn't over-allocate" ")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 117); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "aVector.length() == aVector.capacity()"
") (" "Shouldn't over-allocate" ")"); do { *((volatile int*)
__null) = 117; __attribute__((nomerge)) ::abort(); } while (false
); } } while (false)
;
118 len = aVector.length();
119 ptr = aVector.extractRawBuffer();
120 MOZ_ASSERT(ptr,do { static_assert( mozilla::detail::AssertionConditionType<
decltype(ptr)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(ptr))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("ptr" " (" "How did extractRawBuffer return null if we're not using inline "
"capacity?" ")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 122); AnnotateMozCrashReason("MOZ_ASSERT" "(" "ptr" ") (" "How did extractRawBuffer return null if we're not using inline "
"capacity?" ")"); do { *((volatile int*)__null) = 122; __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
121 "How did extractRawBuffer return null if we're not using inline "do { static_assert( mozilla::detail::AssertionConditionType<
decltype(ptr)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(ptr))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("ptr" " (" "How did extractRawBuffer return null if we're not using inline "
"capacity?" ")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 122); AnnotateMozCrashReason("MOZ_ASSERT" "(" "ptr" ") (" "How did extractRawBuffer return null if we're not using inline "
"capacity?" ")"); do { *((volatile int*)__null) = 122; __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
122 "capacity?")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(ptr)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(ptr))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("ptr" " (" "How did extractRawBuffer return null if we're not using inline "
"capacity?" ")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 122); AnnotateMozCrashReason("MOZ_ASSERT" "(" "ptr" ") (" "How did extractRawBuffer return null if we're not using inline "
"capacity?" ")"); do { *((volatile int*)__null) = 122; __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
123}
124
125template <typename T>
126inline StyleOwnedSlice<T>& StyleOwnedSlice<T>::operator=(
127 const StyleOwnedSlice& aOther) {
128 CopyFrom(aOther);
129 return *this;
130}
131
132template <typename T>
133inline StyleOwnedSlice<T>& StyleOwnedSlice<T>::operator=(
134 StyleOwnedSlice&& aOther) {
135 Clear();
136 SwapElements(aOther);
137 return *this;
138}
139
140template <typename T>
141inline StyleOwnedSlice<T>::~StyleOwnedSlice() {
142 Clear();
143}
144
145// This code is basically a C++ port of the Arc::clone() implementation in
146// servo/components/servo_arc/lib.rs.
147static constexpr const size_t kStaticRefcount =
148 std::numeric_limits<size_t>::max();
149static constexpr const size_t kMaxRefcount =
150 std::numeric_limits<intptr_t>::max();
151
152template <typename T>
153inline void StyleArcInner<T>::IncrementRef() {
154 if (count.load(std::memory_order_relaxed) != kStaticRefcount) {
155 auto old_size = count.fetch_add(1, std::memory_order_relaxed);
156 if (MOZ_UNLIKELY(old_size > kMaxRefcount)(__builtin_expect(!!(old_size > kMaxRefcount), 0))) {
157 ::abort();
158 }
159 }
160}
161
162// This is a C++ port-ish of Arc::drop().
163template <typename T>
164inline bool StyleArcInner<T>::DecrementRef() {
165 if (count.load(std::memory_order_relaxed) == kStaticRefcount) {
166 return false;
167 }
168 if (count.fetch_sub(1, std::memory_order_release) != 1) {
169 return false;
170 }
171#ifdef MOZ_TSAN
172 // TSan doesn't understand std::atomic_thread_fence, so in order
173 // to avoid a false positive for every time a refcounted object
174 // is deleted, we replace the fence with an atomic operation.
175 count.load(std::memory_order_acquire);
176#else
177 std::atomic_thread_fence(std::memory_order_acquire);
178#endif
179 MOZ_LOG_DTOR(this, "ServoArc", 8)do { NS_LogDtor((void*)this, "ServoArc", 8); } while (0);
180 return true;
181}
182
183template <typename H, typename T>
184inline bool StyleHeaderSlice<H, T>::operator==(
185 const StyleHeaderSlice& aOther) const {
186 return header == aOther.header && AsSpan() == aOther.AsSpan();
187}
188
189template <typename H, typename T>
190inline bool StyleHeaderSlice<H, T>::operator!=(
191 const StyleHeaderSlice& aOther) const {
192 return !(*this == aOther);
193}
194
195template <typename H, typename T>
196inline StyleHeaderSlice<H, T>::~StyleHeaderSlice() {
197 for (T& elem : Span(data, len)) {
198 elem.~T();
199 }
200}
201
202template <typename H, typename T>
203inline Span<const T> StyleHeaderSlice<H, T>::AsSpan() const {
204 // Explicitly specify template argument here to avoid instantiating Span<T>
205 // first and then implicitly converting to Span<const T>
206 return Span<const T>{data, len};
207}
208
209static constexpr const uint64_t kArcSliceCanary = 0xf3f3f3f3f3f3f3f3;
210
211#define ASSERT_CANARY \
212 MOZ_DIAGNOSTIC_ASSERT(_0.p->data.header == kArcSliceCanary, "Uh?")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(_0.p->data.header == kArcSliceCanary)>::isValid
, "invalid assertion condition"); if ((__builtin_expect(!!(!(
!!(_0.p->data.header == kArcSliceCanary))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("_0.p->data.header == kArcSliceCanary"
" (" "Uh?" ")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 212); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "_0.p->data.header == kArcSliceCanary"
") (" "Uh?" ")"); do { *((volatile int*)__null) = 212; __attribute__
((nomerge)) ::abort(); } while (false); } } while (false)
;
213
214template <typename T>
215inline StyleArcSlice<T>::StyleArcSlice()
216 : _0(reinterpret_cast<decltype(_0.p)>(Servo_StyleArcSlice_EmptyPtr())) {
217 ASSERT_CANARY
218}
219
220template <typename T>
221inline StyleArcSlice<T>::StyleArcSlice(
222 const StyleForgottenArcSlicePtr<T>& aPtr) {
223 // See the forget() implementation to see why reinterpret_cast() is ok.
224 _0.p = reinterpret_cast<decltype(_0.p)>(aPtr._0);
225 ASSERT_CANARY
226}
227
228template <typename T>
229inline size_t StyleArcSlice<T>::Length() const {
230 ASSERT_CANARY
231 return _0->Length();
232}
233
234template <typename T>
235inline bool StyleArcSlice<T>::IsEmpty() const {
236 ASSERT_CANARY
237 return _0->IsEmpty();
238}
239
240template <typename T>
241inline Span<const T> StyleArcSlice<T>::AsSpan() const {
242 ASSERT_CANARY
243 return _0->AsSpan();
244}
245
246#undef ASSERT_CANARY
247
248template <typename T>
249inline StyleArc<T>::StyleArc(const StyleArc& aOther) : p(aOther.p) {
250 p->IncrementRef();
251}
252
253template <typename T>
254inline void StyleArc<T>::Release() {
255 if (MOZ_LIKELY(!p->DecrementRef())(__builtin_expect(!!(!p->DecrementRef()), 1))) {
256 return;
257 }
258 p->data.~T();
259 free(p);
260}
261
262template <typename T>
263inline StyleArc<T>& StyleArc<T>::operator=(const StyleArc& aOther) {
264 if (p != aOther.p) {
265 Release();
266 p = aOther.p;
267 p->IncrementRef();
268 }
269 return *this;
270}
271
272template <typename T>
273inline StyleArc<T>& StyleArc<T>::operator=(StyleArc&& aOther) {
274 std::swap(p, aOther.p);
275 return *this;
276}
277
278template <typename T>
279inline StyleArc<T>::~StyleArc() {
280 Release();
281}
282
283inline bool StyleAtom::IsStatic() const { return !!(_0 & 1); }
284
285inline nsAtom* StyleAtom::AsAtom() const {
286 if (IsStatic()) {
287 return const_cast<nsStaticAtom*>(&detail::gGkAtoms.mAtoms[_0 >> 1]);
288 }
289 return reinterpret_cast<nsAtom*>(_0);
290}
291
292inline void StyleAtom::AddRef() {
293 if (!IsStatic()) {
294 AsAtom()->AddRef();
295 }
296}
297
298inline void StyleAtom::Release() {
299 if (!IsStatic()) {
300 AsAtom()->Release();
301 }
302}
303
304inline StyleAtom::StyleAtom(already_AddRefed<nsAtom> aAtom) {
305 nsAtom* atom = aAtom.take();
306 if (atom->IsStatic()) {
307 size_t index = atom->AsStatic() - &detail::gGkAtoms.mAtoms[0];
308 _0 = (index << 1) | 1;
309 } else {
310 _0 = reinterpret_cast<uintptr_t>(atom);
311 }
312 MOZ_ASSERT(IsStatic() == atom->IsStatic())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsStatic() == atom->IsStatic())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsStatic() == atom->IsStatic
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("IsStatic() == atom->IsStatic()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 312); AnnotateMozCrashReason("MOZ_ASSERT" "(" "IsStatic() == atom->IsStatic()"
")"); do { *((volatile int*)__null) = 312; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
313 MOZ_ASSERT(AsAtom() == atom)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(AsAtom() == atom)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(AsAtom() == atom))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("AsAtom() == atom"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 313); AnnotateMozCrashReason("MOZ_ASSERT" "(" "AsAtom() == atom"
")"); do { *((volatile int*)__null) = 313; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
314}
315
316inline StyleAtom::StyleAtom(nsStaticAtom* aAtom)
317 : StyleAtom(do_AddRef(static_cast<nsAtom*>(aAtom))) {}
318
319inline StyleAtom::StyleAtom(const StyleAtom& aOther) : _0(aOther._0) {
320 AddRef();
321}
322
323inline StyleAtom& StyleAtom::operator=(const StyleAtom& aOther) {
324 if (MOZ_LIKELY(this != &aOther)(__builtin_expect(!!(this != &aOther), 1))) {
325 Release();
326 _0 = aOther._0;
327 AddRef();
328 }
329 return *this;
330}
331
332inline StyleAtom::~StyleAtom() { Release(); }
333
334inline nsAtom* StyleCustomIdent::AsAtom() const { return _0.AsAtom(); }
335
336inline nsDependentCSubstring StyleOwnedStr::AsString() const {
337 Span<const uint8_t> s = _0.AsSpan();
338 return nsDependentCSubstring(reinterpret_cast<const char*>(s.Elements()),
339 s.Length());
340}
341
342template <typename T>
343inline Span<const T> StyleGenericTransform<T>::Operations() const {
344 return _0.AsSpan();
345}
346
347template <typename T>
348inline bool StyleGenericTransform<T>::IsNone() const {
349 return Operations().IsEmpty();
350}
351
352inline StyleAngle StyleAngle::Zero() { return {0.0f}; }
353
354inline float StyleAngle::ToDegrees() const { return _0; }
355
356inline double StyleAngle::ToRadians() const {
357 return double(ToDegrees()) * M_PI3.14159265358979323846 / 180.0;
358}
359
360inline bool StyleUrlExtraData::IsShared() const { return !!(_0 & 1); }
361
362inline StyleUrlExtraData::~StyleUrlExtraData() {
363 if (!IsShared()) {
364 reinterpret_cast<URLExtraData*>(_0)->Release();
365 }
366}
367
368inline const URLExtraData& StyleUrlExtraData::get() const {
369 if (IsShared()) {
370 return *URLExtraData::sShared[_0 >> 1];
371 }
372 return *reinterpret_cast<const URLExtraData*>(_0);
373}
374
375inline nsDependentCSubstring StyleCssUrl::SpecifiedSerialization() const {
376 return _0->serialization.AsString();
377}
378
379inline const URLExtraData& StyleCssUrl::ExtraData() const {
380 return _0->extra_data.get();
381}
382
383inline StyleLoadData& StyleCssUrl::LoadData() const {
384 if (MOZ_LIKELY(_0->load_data.tag == StyleLoadDataSource::Tag::Owned)(__builtin_expect(!!(_0->load_data.tag == StyleLoadDataSource
::Tag::Owned), 1))
) {
385 MOZ_DIAGNOSTIC_ASSERT(NS_IsMainThread() ||do { static_assert( mozilla::detail::AssertionConditionType<
decltype(NS_IsMainThread() || dom::IsCurrentThreadRunningWorker
())>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(NS_IsMainThread() || dom::IsCurrentThreadRunningWorker
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("NS_IsMainThread() || dom::IsCurrentThreadRunningWorker()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 386); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "NS_IsMainThread() || dom::IsCurrentThreadRunningWorker()"
")"); do { *((volatile int*)__null) = 386; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
386 dom::IsCurrentThreadRunningWorker())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(NS_IsMainThread() || dom::IsCurrentThreadRunningWorker
())>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(NS_IsMainThread() || dom::IsCurrentThreadRunningWorker
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("NS_IsMainThread() || dom::IsCurrentThreadRunningWorker()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 386); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "NS_IsMainThread() || dom::IsCurrentThreadRunningWorker()"
")"); do { *((volatile int*)__null) = 386; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
387 return const_cast<StyleLoadData&>(_0->load_data.owned._0);
388 }
389 MOZ_DIAGNOSTIC_ASSERT(NS_IsMainThread(),do { static_assert( mozilla::detail::AssertionConditionType<
decltype(NS_IsMainThread())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(NS_IsMainThread()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("NS_IsMainThread()"
" (" "Lazy load datas should come from user-agent sheets, " "which don't make sense on workers"
")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 391); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "NS_IsMainThread()"
") (" "Lazy load datas should come from user-agent sheets, "
"which don't make sense on workers" ")"); do { *((volatile int
*)__null) = 391; __attribute__((nomerge)) ::abort(); } while (
false); } } while (false)
390 "Lazy load datas should come from user-agent sheets, "do { static_assert( mozilla::detail::AssertionConditionType<
decltype(NS_IsMainThread())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(NS_IsMainThread()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("NS_IsMainThread()"
" (" "Lazy load datas should come from user-agent sheets, " "which don't make sense on workers"
")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 391); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "NS_IsMainThread()"
") (" "Lazy load datas should come from user-agent sheets, "
"which don't make sense on workers" ")"); do { *((volatile int
*)__null) = 391; __attribute__((nomerge)) ::abort(); } while (
false); } } while (false)
391 "which don't make sense on workers")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(NS_IsMainThread())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(NS_IsMainThread()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("NS_IsMainThread()"
" (" "Lazy load datas should come from user-agent sheets, " "which don't make sense on workers"
")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 391); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "NS_IsMainThread()"
") (" "Lazy load datas should come from user-agent sheets, "
"which don't make sense on workers" ")"); do { *((volatile int
*)__null) = 391; __attribute__((nomerge)) ::abort(); } while (
false); } } while (false)
;
392 return const_cast<StyleLoadData&>(*Servo_LoadData_GetLazy(&_0->load_data));
393}
394
395inline nsIURI* StyleCssUrl::GetURI() const {
396 auto& loadData = LoadData();
397 if (!(loadData.flags & StyleLoadDataFlags::TRIED_TO_RESOLVE_URI)) {
398 loadData.flags |= StyleLoadDataFlags::TRIED_TO_RESOLVE_URI;
399 nsDependentCSubstring serialization = SpecifiedSerialization();
400 // https://drafts.csswg.org/css-values-4/#url-empty:
401 //
402 // If the value of the url() is the empty string (like url("") or
403 // url()), the url must resolve to an invalid resource (similar to what
404 // the url about:invalid does).
405 //
406 if (!serialization.IsEmpty()) {
407 RefPtr<nsIURI> resolved;
408 NS_NewURI(getter_AddRefs(resolved), serialization, nullptr,
409 ExtraData().BaseURI());
410 loadData.resolved_uri = resolved.forget().take();
411 }
412 }
413 return loadData.resolved_uri;
414}
415
416inline nsDependentCSubstring StyleComputedUrl::SpecifiedSerialization() const {
417 return _0.SpecifiedSerialization();
418}
419inline const URLExtraData& StyleComputedUrl::ExtraData() const {
420 return _0.ExtraData();
421}
422inline StyleLoadData& StyleComputedUrl::LoadData() const {
423 return _0.LoadData();
424}
425inline StyleCorsMode StyleComputedUrl::CorsMode() const {
426 return _0._0->cors_mode;
427}
428inline nsIURI* StyleComputedUrl::GetURI() const { return _0.GetURI(); }
429
430inline bool StyleComputedUrl::IsLocalRef() const {
431 return Servo_CssUrl_IsLocalRef(&_0);
432}
433
434inline bool StyleComputedUrl::HasRef() const {
435 if (IsLocalRef()) {
436 return true;
437 }
438 if (nsIURI* uri = GetURI()) {
439 bool hasRef = false;
440 return NS_SUCCEEDED(uri->GetHasRef(&hasRef))((bool)(__builtin_expect(!!(!NS_FAILED_impl(uri->GetHasRef
(&hasRef))), 1)))
&& hasRef;
441 }
442 return false;
443}
444
445inline bool StyleComputedImageUrl::IsImageResolved() const {
446 return bool(LoadData().flags & StyleLoadDataFlags::TRIED_TO_RESOLVE_IMAGE);
447}
448
449inline imgRequestProxy* StyleComputedImageUrl::GetImage() const {
450 MOZ_ASSERT(IsImageResolved())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsImageResolved())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsImageResolved()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("IsImageResolved()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 450); AnnotateMozCrashReason("MOZ_ASSERT" "(" "IsImageResolved()"
")"); do { *((volatile int*)__null) = 450; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
451 return LoadData().resolved_image;
452}
453
454template <>
455inline bool StyleGradient::Repeating() const {
456 if (IsLinear()) {
457 return bool(AsLinear().flags & StyleGradientFlags::REPEATING);
458 }
459 if (IsRadial()) {
460 return bool(AsRadial().flags & StyleGradientFlags::REPEATING);
461 }
462 return bool(AsConic().flags & StyleGradientFlags::REPEATING);
463}
464
465template <>
466bool StyleGradient::IsOpaque() const;
467
468template <>
469inline const StyleColorInterpolationMethod&
470StyleGradient::ColorInterpolationMethod() const {
471 if (IsLinear()) {
472 return AsLinear().color_interpolation_method;
473 }
474 if (IsRadial()) {
475 return AsRadial().color_interpolation_method;
476 }
477 return AsConic().color_interpolation_method;
478}
479
480template <typename Integer>
481inline StyleGenericGridLine<Integer>::StyleGenericGridLine()
482 : ident{StyleAtom(nsGkAtoms::_empty)}, line_num(0), is_span(false) {}
483
484template <>
485inline nsAtom* StyleGridLine::LineName() const {
486 return ident.AsAtom();
487}
488
489template <>
490inline bool StyleGridLine::IsAuto() const {
491 return LineName()->IsEmpty() && line_num == 0 && !is_span;
492}
493
494using LengthPercentage = StyleLengthPercentage;
495using LengthPercentageOrAuto = StyleLengthPercentageOrAuto;
496using NonNegativeLengthPercentage = StyleNonNegativeLengthPercentage;
497using NonNegativeLengthPercentageOrAuto =
498 StyleNonNegativeLengthPercentageOrAuto;
499using NonNegativeLengthPercentageOrNormal =
500 StyleNonNegativeLengthPercentageOrNormal;
501using Length = StyleLength;
502using LengthOrAuto = StyleLengthOrAuto;
503using NonNegativeLength = StyleNonNegativeLength;
504using NonNegativeLengthOrAuto = StyleNonNegativeLengthOrAuto;
505using BorderRadius = StyleBorderRadius;
506
507bool StyleCSSPixelLength::IsZero() const { return _0 == 0.0f; }
508
509void StyleCSSPixelLength::ScaleBy(float aScale) { _0 *= aScale; }
510
511StyleCSSPixelLength StyleCSSPixelLength::ScaledBy(float aScale) const {
512 return FromPixels(ToCSSPixels() * aScale);
513}
514
515namespace detail {
516static inline nscoord DefaultPercentLengthToAppUnits(float aPixelLength) {
517 return NSToCoordTruncClamped(aPixelLength);
518}
519
520static inline nscoord DefaultLengthToAppUnits(float aPixelLength) {
521 // We want to round lengths rounding 0.5 away from zero, instead of the
522 // default behavior of NSToCoordRound{,WithClamp} which do floor(x + 0.5).
523 float length = aPixelLength * float(mozilla::AppUnitsPerCSSPixel());
524 if (length >= float(nscoord_MAX)) {
525 return nscoord_MAX;
526 }
527 if (length <= float(nscoord_MIN)) {
528 return nscoord_MIN;
529 }
530 return NSToIntRound(length);
531}
532} // namespace detail
533
534nscoord StyleCSSPixelLength::ToAppUnits() const {
535 if (IsZero()) {
536 // Avoid the expensive FP math below.
537 return 0;
538 }
539 return detail::DefaultLengthToAppUnits(_0);
540}
541
542bool LengthPercentage::IsLength() const { return Tag() == TAG_LENGTH; }
543
544StyleLengthPercentageUnion::StyleLengthPercentageUnion() {
545 length = {TAG_LENGTH, {0.0f}};
546 MOZ_ASSERT(IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLength()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 546); AnnotateMozCrashReason("MOZ_ASSERT" "(" "IsLength()" ")"
); do { *((volatile int*)__null) = 546; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
547}
548
549static_assert(sizeof(LengthPercentage) == sizeof(uint64_t), "");
550
551Length& LengthPercentage::AsLength() {
552 MOZ_ASSERT(IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsLength()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 552); AnnotateMozCrashReason("MOZ_ASSERT" "(" "IsLength()" ")"
); do { *((volatile int*)__null) = 552; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
553 return length.length;
554}
555
556const Length& LengthPercentage::AsLength() const {
557 return const_cast<LengthPercentage*>(this)->AsLength();
558}
559
560bool LengthPercentage::IsPercentage() const { return Tag() == TAG_PERCENTAGE; }
561
562StylePercentage& LengthPercentage::AsPercentage() {
563 MOZ_ASSERT(IsPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsPercentage()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("IsPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 563); AnnotateMozCrashReason("MOZ_ASSERT" "(" "IsPercentage()"
")"); do { *((volatile int*)__null) = 563; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
564 return percentage.percentage;
565}
566
567const StylePercentage& LengthPercentage::AsPercentage() const {
568 return const_cast<LengthPercentage*>(this)->AsPercentage();
569}
570
571bool LengthPercentage::IsCalc() const { return Tag() == TAG_CALC; }
572
573StyleCalcLengthPercentage& LengthPercentage::AsCalc() {
574 MOZ_ASSERT(IsCalc())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsCalc())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsCalc()))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("IsCalc()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 574); AnnotateMozCrashReason("MOZ_ASSERT" "(" "IsCalc()" ")"
); do { *((volatile int*)__null) = 574; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
575 // NOTE: in 32-bits, the pointer is not swapped, and goes along with the tag.
576#ifdef SERVO_32_BITS
577 return *reinterpret_cast<StyleCalcLengthPercentage*>(calc.ptr);
578#else
579 return *reinterpret_cast<StyleCalcLengthPercentage*>(
580 NativeEndian::swapFromLittleEndian(calc.ptr));
581#endif
582}
583
584const StyleCalcLengthPercentage& LengthPercentage::AsCalc() const {
585 return const_cast<LengthPercentage*>(this)->AsCalc();
586}
587
588StyleLengthPercentageUnion::StyleLengthPercentageUnion(const Self& aOther) {
589 if (aOther.IsLength()) {
590 length = {TAG_LENGTH, aOther.AsLength()};
591 } else if (aOther.IsPercentage()) {
592 percentage = {TAG_PERCENTAGE, aOther.AsPercentage()};
593 } else {
594 MOZ_ASSERT(aOther.IsCalc())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aOther.IsCalc())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aOther.IsCalc()))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("aOther.IsCalc()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 594); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aOther.IsCalc()"
")"); do { *((volatile int*)__null) = 594; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
595 auto* ptr = new StyleCalcLengthPercentage(aOther.AsCalc());
596 // NOTE: in 32-bits, the pointer is not swapped, and goes along with the
597 // tag.
598 calc = {
599#ifdef SERVO_32_BITS
600 TAG_CALC,
601 ptr,
602#else
603 NativeEndian::swapToLittleEndian(reinterpret_cast<uintptr_t>(ptr)),
604#endif
605 };
606 }
607 MOZ_ASSERT(Tag() == aOther.Tag())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(Tag() == aOther.Tag())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(Tag() == aOther.Tag()))), 0)
)) { do { } while (false); MOZ_ReportAssertionFailure("Tag() == aOther.Tag()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 607); AnnotateMozCrashReason("MOZ_ASSERT" "(" "Tag() == aOther.Tag()"
")"); do { *((volatile int*)__null) = 607; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
608}
609
610StyleLengthPercentageUnion::~StyleLengthPercentageUnion() {
611 if (IsCalc()) {
3
Assuming the condition is true
4
Taking true branch
612 delete &AsCalc();
5
Calling implicit destructor for 'StyleCalcLengthPercentage'
6
Calling '~StyleGenericCalcNode'
613 }
614}
615
616LengthPercentage& LengthPercentage::operator=(const LengthPercentage& aOther) {
617 if (this != &aOther) {
618 this->~LengthPercentage();
619 new (this) LengthPercentage(aOther);
620 }
621 return *this;
622}
623
624bool LengthPercentage::operator==(const LengthPercentage& aOther) const {
625 if (Tag() != aOther.Tag()) {
626 return false;
627 }
628 if (IsLength()) {
629 return AsLength() == aOther.AsLength();
630 }
631 if (IsPercentage()) {
632 return AsPercentage() == aOther.AsPercentage();
633 }
634 return AsCalc() == aOther.AsCalc();
635}
636
637bool LengthPercentage::operator!=(const LengthPercentage& aOther) const {
638 return !(*this == aOther);
639}
640
641LengthPercentage LengthPercentage::Zero() { return {}; }
642
643LengthPercentage LengthPercentage::FromPixels(CSSCoord aCoord) {
644 LengthPercentage l;
645 MOZ_ASSERT(l.IsLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(l.IsLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(l.IsLength()))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("l.IsLength()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 645); AnnotateMozCrashReason("MOZ_ASSERT" "(" "l.IsLength()"
")"); do { *((volatile int*)__null) = 645; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
646 l.length.length = {aCoord};
647 return l;
648}
649
650LengthPercentage LengthPercentage::FromAppUnits(nscoord aCoord) {
651 return FromPixels(CSSPixel::FromAppUnits(aCoord));
652}
653
654LengthPercentage LengthPercentage::FromPercentage(float aPercentage) {
655 LengthPercentage l;
656 l.percentage = {TAG_PERCENTAGE, {aPercentage}};
657 return l;
658}
659
660bool LengthPercentage::HasPercent() const { return IsPercentage() || IsCalc(); }
661
662bool LengthPercentage::ConvertsToLength() const { return IsLength(); }
663
664nscoord LengthPercentage::ToLength() const {
665 MOZ_ASSERT(ConvertsToLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(ConvertsToLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(ConvertsToLength()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("ConvertsToLength()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 665); AnnotateMozCrashReason("MOZ_ASSERT" "(" "ConvertsToLength()"
")"); do { *((volatile int*)__null) = 665; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
666 return AsLength().ToAppUnits();
667}
668
669CSSCoord LengthPercentage::ToLengthInCSSPixels() const {
670 MOZ_ASSERT(ConvertsToLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(ConvertsToLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(ConvertsToLength()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("ConvertsToLength()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 670); AnnotateMozCrashReason("MOZ_ASSERT" "(" "ConvertsToLength()"
")"); do { *((volatile int*)__null) = 670; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
671 return AsLength().ToCSSPixels();
672}
673
674bool LengthPercentage::ConvertsToPercentage() const { return IsPercentage(); }
675
676float LengthPercentage::ToPercentage() const {
677 MOZ_ASSERT(ConvertsToPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(ConvertsToPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(ConvertsToPercentage()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("ConvertsToPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 677); AnnotateMozCrashReason("MOZ_ASSERT" "(" "ConvertsToPercentage()"
")"); do { *((volatile int*)__null) = 677; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
678 return AsPercentage()._0;
679}
680
681bool LengthPercentage::HasLengthAndPercentage() const {
682 if (!IsCalc()) {
683 return false;
684 }
685 MOZ_ASSERT(!ConvertsToLength() && !ConvertsToPercentage(),do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!ConvertsToLength() && !ConvertsToPercentage
())>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(!ConvertsToLength() && !ConvertsToPercentage
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("!ConvertsToLength() && !ConvertsToPercentage()" " ("
"Should've been simplified earlier" ")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 686); AnnotateMozCrashReason("MOZ_ASSERT" "(" "!ConvertsToLength() && !ConvertsToPercentage()"
") (" "Should've been simplified earlier" ")"); do { *((volatile
int*)__null) = 686; __attribute__((nomerge)) ::abort(); } while
(false); } } while (false)
686 "Should've been simplified earlier")do { static_assert( mozilla::detail::AssertionConditionType<
decltype(!ConvertsToLength() && !ConvertsToPercentage
())>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(!ConvertsToLength() && !ConvertsToPercentage
()))), 0))) { do { } while (false); MOZ_ReportAssertionFailure
("!ConvertsToLength() && !ConvertsToPercentage()" " ("
"Should've been simplified earlier" ")", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 686); AnnotateMozCrashReason("MOZ_ASSERT" "(" "!ConvertsToLength() && !ConvertsToPercentage()"
") (" "Should've been simplified earlier" ")"); do { *((volatile
int*)__null) = 686; __attribute__((nomerge)) ::abort(); } while
(false); } } while (false)
;
687 return true;
688}
689
690bool LengthPercentage::IsDefinitelyZero() const {
691 if (IsLength()) {
692 return AsLength().IsZero();
693 }
694 if (IsPercentage()) {
695 return AsPercentage()._0 == 0.0f;
696 }
697 // calc() should've been simplified to a percentage.
698 return false;
699}
700
701CSSCoord StyleCalcLengthPercentage::ResolveToCSSPixels(CSSCoord aBasis) const {
702 return Servo_ResolveCalcLengthPercentage(this, aBasis);
703}
704
705template <typename Rounder>
706nscoord StyleCalcLengthPercentage::Resolve(nscoord aBasis,
707 Rounder aRounder) const {
708 static_assert(std::is_same_v<decltype(aRounder(1.0f)), nscoord>);
709 CSSCoord result = ResolveToCSSPixels(CSSPixel::FromAppUnits(aBasis));
710 return aRounder(result * AppUnitsPerCSSPixel());
711}
712
713template <>
714void StyleCalcNode::ScaleLengthsBy(float);
715
716CSSCoord LengthPercentage::ResolveToCSSPixels(CSSCoord aPercentageBasis) const {
717 if (IsLength()) {
718 return AsLength().ToCSSPixels();
719 }
720 if (IsPercentage()) {
721 return AsPercentage()._0 * aPercentageBasis;
722 }
723 return AsCalc().ResolveToCSSPixels(aPercentageBasis);
724}
725
726template <typename T>
727CSSCoord LengthPercentage::ResolveToCSSPixelsWith(T aPercentageGetter) const {
728 static_assert(std::is_same_v<decltype(aPercentageGetter()), CSSCoord>);
729 if (ConvertsToLength()) {
730 return ToLengthInCSSPixels();
731 }
732 return ResolveToCSSPixels(aPercentageGetter());
733}
734
735template <typename T, typename Rounder>
736nscoord LengthPercentage::Resolve(T aPercentageGetter, Rounder aRounder) const {
737 static_assert(std::is_same_v<decltype(aPercentageGetter()), nscoord>);
738 static_assert(std::is_same_v<decltype(aRounder(1.0f)), nscoord>);
739 if (ConvertsToLength()) {
740 return ToLength();
741 }
742 if (IsPercentage() && AsPercentage()._0 == 0.0f) {
743 return 0;
744 }
745 nscoord basis = aPercentageGetter();
746 if (IsPercentage()) {
747 return aRounder(basis * AsPercentage()._0);
748 }
749 return AsCalc().Resolve(basis, aRounder);
750}
751
752nscoord LengthPercentage::Resolve(nscoord aPercentageBasis) const {
753 return Resolve([=] { return aPercentageBasis; },
754 detail::DefaultPercentLengthToAppUnits);
755}
756
757template <typename T>
758nscoord LengthPercentage::Resolve(T aPercentageGetter) const {
759 return Resolve(aPercentageGetter, detail::DefaultPercentLengthToAppUnits);
760}
761
762template <typename Rounder>
763nscoord LengthPercentage::Resolve(nscoord aPercentageBasis,
764 Rounder aRounder) const {
765 return Resolve([aPercentageBasis] { return aPercentageBasis; }, aRounder);
766}
767
768void LengthPercentage::ScaleLengthsBy(float aScale) {
769 if (IsLength()) {
770 AsLength().ScaleBy(aScale);
771 }
772 if (IsCalc()) {
773 AsCalc().node.ScaleLengthsBy(aScale);
774 }
775}
776
777#define IMPL_LENGTHPERCENTAGE_FORWARDS(ty_) \
778 template <> \
779 inline bool ty_::HasPercent() const { \
780 return IsLengthPercentage() && AsLengthPercentage().HasPercent(); \
781 } \
782 template <> \
783 inline bool ty_::ConvertsToLength() const { \
784 return IsLengthPercentage() && AsLengthPercentage().ConvertsToLength(); \
785 } \
786 template <> \
787 inline bool ty_::HasLengthAndPercentage() const { \
788 return IsLengthPercentage() && \
789 AsLengthPercentage().HasLengthAndPercentage(); \
790 } \
791 template <> \
792 inline nscoord ty_::ToLength() const { \
793 MOZ_ASSERT(ConvertsToLength())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(ConvertsToLength())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(ConvertsToLength()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("ConvertsToLength()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 793); AnnotateMozCrashReason("MOZ_ASSERT" "(" "ConvertsToLength()"
")"); do { *((volatile int*)__null) = 793; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
; \
794 return AsLengthPercentage().ToLength(); \
795 } \
796 template <> \
797 inline bool ty_::ConvertsToPercentage() const { \
798 return IsLengthPercentage() && \
799 AsLengthPercentage().ConvertsToPercentage(); \
800 } \
801 template <> \
802 inline float ty_::ToPercentage() const { \
803 MOZ_ASSERT(ConvertsToPercentage())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(ConvertsToPercentage())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(ConvertsToPercentage()))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("ConvertsToPercentage()"
, "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 803); AnnotateMozCrashReason("MOZ_ASSERT" "(" "ConvertsToPercentage()"
")"); do { *((volatile int*)__null) = 803; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
; \
804 return AsLengthPercentage().ToPercentage(); \
805 }
806
807IMPL_LENGTHPERCENTAGE_FORWARDS(LengthPercentageOrAuto)
808IMPL_LENGTHPERCENTAGE_FORWARDS(StyleSize)
809IMPL_LENGTHPERCENTAGE_FORWARDS(StyleMaxSize)
810IMPL_LENGTHPERCENTAGE_FORWARDS(StyleInset)
811IMPL_LENGTHPERCENTAGE_FORWARDS(StyleMargin)
812
813template <>
814inline bool StyleInset::IsAnchorPositioningFunction() const {
815 return IsAnchorFunction() || IsAnchorSizeFunction();
816}
817
818#undef IMPL_LENGTHPERCENTAGE_FORWARDS
819
820template <>
821inline bool LengthOrAuto::IsLength() const {
822 return IsLengthPercentage();
823}
824
825template <>
826inline const Length& LengthOrAuto::AsLength() const {
827 return AsLengthPercentage();
828}
829
830template <>
831inline nscoord LengthOrAuto::ToLength() const {
832 return AsLength().ToAppUnits();
833}
834
835template <>
836inline bool StyleFlexBasis::IsAuto() const {
837 return IsSize() && AsSize().IsAuto();
838}
839
840#define IMPL_BEHAVES_LIKE_SIZE_METHODS(ty_, isInitialValMethod_) \
841 template <> \
842 inline bool ty_::BehavesLikeStretchOnInlineAxis() const { \
843 return IsStretch() || IsMozAvailable() || IsWebkitFillAvailable(); \
844 } \
845 template <> \
846 inline bool ty_::BehavesLikeStretchOnBlockAxis() const { \
847 /* TODO(dholbert): Add "|| IsMozAvailable()" in bug 527285. */ \
848 return IsStretch() || IsWebkitFillAvailable(); \
849 } \
850 template <> \
851 inline bool ty_::BehavesLikeInitialValueOnBlockAxis() const { \
852 return isInitialValMethod_() || \
853 (!BehavesLikeStretchOnBlockAxis() && !IsLengthPercentage()); \
854 }
855
856IMPL_BEHAVES_LIKE_SIZE_METHODS(StyleSize, IsAuto)
857IMPL_BEHAVES_LIKE_SIZE_METHODS(StyleMaxSize, IsNone)
858
859#undef IMPL_BEHAVES_LIKE_SIZE_METHODS
860
861template <>
862inline bool StyleBackgroundSize::IsInitialValue() const {
863 return IsExplicitSize() && explicit_size.width.IsAuto() &&
864 explicit_size.height.IsAuto();
865}
866
867template <typename T>
868const T& StyleRect<T>::Get(mozilla::Side aSide) const {
869 static_assert(sizeof(StyleRect<T>) == sizeof(T) * 4, "");
870 static_assert(alignof(StyleRect<T>) == alignof(T), "");
871 return reinterpret_cast<const T*>(this)[aSide];
872}
873
874template <typename T>
875T& StyleRect<T>::Get(mozilla::Side aSide) {
876 return const_cast<T&>(static_cast<const StyleRect&>(*this).Get(aSide));
877}
878
879template <typename T>
880template <typename Predicate>
881bool StyleRect<T>::All(Predicate aPredicate) const {
882 return aPredicate(_0) && aPredicate(_1) && aPredicate(_2) && aPredicate(_3);
883}
884
885template <typename T>
886template <typename Predicate>
887bool StyleRect<T>::Any(Predicate aPredicate) const {
888 return aPredicate(_0) || aPredicate(_1) || aPredicate(_2) || aPredicate(_3);
889}
890
891template <>
892inline const LengthPercentage& BorderRadius::Get(HalfCorner aCorner) const {
893 static_assert(sizeof(BorderRadius) == sizeof(LengthPercentage) * 8, "");
894 static_assert(alignof(BorderRadius) == alignof(LengthPercentage), "");
895 const auto* self = reinterpret_cast<const LengthPercentage*>(this);
896 return self[aCorner];
897}
898
899template <>
900inline bool StyleTrackBreadth::HasPercent() const {
901 return IsBreadth() && AsBreadth().HasPercent();
902}
903
904// Implemented in nsStyleStructs.cpp
905template <>
906bool StyleTransform::HasPercent() const;
907
908template <>
909inline bool StyleTransformOrigin::HasPercent() const {
910 // NOTE(emilio): `depth` is just a `<length>` so doesn't have a percentage at
911 // all.
912 return horizontal.HasPercent() || vertical.HasPercent();
913}
914
915template <>
916inline Maybe<size_t> StyleGridTemplateComponent::RepeatAutoIndex() const {
917 if (!IsTrackList()) {
918 return Nothing();
919 }
920 const auto& list = *AsTrackList();
921 return list.auto_repeat_index < list.values.Length()
922 ? Some(list.auto_repeat_index)
923 : Nothing();
924}
925
926template <>
927inline bool StyleGridTemplateComponent::HasRepeatAuto() const {
928 return RepeatAutoIndex().isSome();
929}
930
931template <>
932inline Span<const StyleGenericTrackListValue<LengthPercentage, StyleInteger>>
933StyleGridTemplateComponent::TrackListValues() const {
934 if (IsTrackList()) {
935 return AsTrackList()->values.AsSpan();
936 }
937 return {};
938}
939
940template <>
941inline const StyleGenericTrackRepeat<LengthPercentage, StyleInteger>*
942StyleGridTemplateComponent::GetRepeatAutoValue() const {
943 auto index = RepeatAutoIndex();
944 if (!index) {
945 return nullptr;
946 }
947 return &TrackListValues()[*index].AsTrackRepeat();
948}
949
950constexpr const auto kPaintOrderShift = StylePAINT_ORDER_SHIFT;
951constexpr const auto kPaintOrderMask = StylePAINT_ORDER_MASK;
952
953template <>
954inline nsRect StyleGenericClipRect<LengthOrAuto>::ToLayoutRect(
955 nscoord aAutoSize) const {
956 nscoord x = left.IsLength() ? left.ToLength() : 0;
957 nscoord y = top.IsLength() ? top.ToLength() : 0;
958 nscoord width = right.IsLength() ? right.ToLength() - x : aAutoSize;
959 nscoord height = bottom.IsLength() ? bottom.ToLength() - y : aAutoSize;
960 return nsRect(x, y, width, height);
961}
962
963using RestyleHint = StyleRestyleHint;
964
965inline RestyleHint RestyleHint::RestyleSubtree() {
966 return RESTYLE_SELF | RESTYLE_DESCENDANTS;
967}
968
969inline RestyleHint RestyleHint::RecascadeSubtree() {
970 return RECASCADE_SELF | RECASCADE_DESCENDANTS;
971}
972
973inline RestyleHint RestyleHint::ForAnimations() {
974 return RESTYLE_CSS_TRANSITIONS | RESTYLE_CSS_ANIMATIONS | RESTYLE_SMIL;
975}
976
977inline bool RestyleHint::DefinitelyRecascadesAllSubtree() const {
978 if (!(*this & (RECASCADE_DESCENDANTS | RESTYLE_DESCENDANTS))) {
979 return false;
980 }
981 return bool(*this & (RESTYLE_SELF | RECASCADE_SELF));
982}
983
984template <>
985ImageResolution StyleImage::GetResolution(const ComputedStyle&) const;
986
987template <>
988inline const StyleImage& StyleImage::FinalImage() const {
989 if (!IsImageSet()) {
990 return *this;
991 }
992 const auto& set = *AsImageSet();
993 auto items = set.items.AsSpan();
994 if (MOZ_LIKELY(set.selected_index < items.Length())(__builtin_expect(!!(set.selected_index < items.Length()),
1))
) {
995 return items[set.selected_index].image.FinalImage();
996 }
997 static auto sNone = StyleImage::None();
998 return sNone;
999}
1000
1001template <>
1002inline bool StyleImage::IsImageRequestType() const {
1003 const auto& finalImage = FinalImage();
1004 return finalImage.IsUrl();
1005}
1006
1007template <>
1008inline const StyleComputedImageUrl* StyleImage::GetImageRequestURLValue()
1009 const {
1010 const auto& finalImage = FinalImage();
1011 if (finalImage.IsUrl()) {
1012 return &finalImage.AsUrl();
1013 }
1014 return nullptr;
1015}
1016
1017template <>
1018inline imgRequestProxy* StyleImage::GetImageRequest() const {
1019 const auto* url = GetImageRequestURLValue();
1020 return url ? url->GetImage() : nullptr;
1021}
1022
1023template <>
1024inline bool StyleImage::IsResolved() const {
1025 const auto* url = GetImageRequestURLValue();
1026 return !url || url->IsImageResolved();
1027}
1028
1029template <>
1030bool StyleImage::IsOpaque() const;
1031template <>
1032bool StyleImage::IsSizeAvailable() const;
1033template <>
1034bool StyleImage::IsComplete() const;
1035template <>
1036void StyleImage::ResolveImage(dom::Document&, const StyleImage*);
1037
1038template <>
1039inline AspectRatio StyleRatio<StyleNonNegativeNumber>::ToLayoutRatio(
1040 UseBoxSizing aUseBoxSizing) const {
1041 // 0/1, 1/0, and 0/0 are all degenerate ratios (which behave as auto), and we
1042 // always return 0.0f.
1043 // https://drafts.csswg.org/css-values-4/#degenerate-ratio
1044 return AspectRatio::FromSize(_0, _1, aUseBoxSizing);
1045}
1046
1047template <>
1048inline AspectRatio StyleAspectRatio::ToLayoutRatio() const {
1049 return HasRatio() ? ratio.AsRatio().ToLayoutRatio(auto_ ? UseBoxSizing::No
1050 : UseBoxSizing::Yes)
1051 : AspectRatio();
1052}
1053
1054inline void StyleFontWeight::ToString(nsACString& aString) const {
1055 Servo_FontWeight_ToCss(this, &aString);
1056}
1057
1058inline void StyleFontStretch::ToString(nsACString& aString) const {
1059 Servo_FontStretch_ToCss(this, &aString);
1060}
1061
1062inline void StyleFontStyle::ToString(nsACString& aString) const {
1063 Servo_FontStyle_ToCss(this, &aString);
1064}
1065
1066inline bool StyleFontWeight::IsBold() const { return *this >= BOLD_THRESHOLD; }
1067
1068inline bool StyleFontStyle::IsItalic() const { return *this == ITALIC; }
1069
1070inline bool StyleFontStyle::IsOblique() const {
1071 return !IsItalic() && !IsNormal();
1072}
1073
1074inline float StyleFontStyle::ObliqueAngle() const {
1075 MOZ_ASSERT(IsOblique())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(IsOblique())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(IsOblique()))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("IsOblique()", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 1075); AnnotateMozCrashReason("MOZ_ASSERT" "(" "IsOblique()"
")"); do { *((volatile int*)__null) = 1075; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
1076 return ToFloat();
1077}
1078
1079inline float StyleFontStyle::SlantAngle() const {
1080 return IsNormal() ? 0 : IsItalic() ? DEFAULT_OBLIQUE_DEGREES : ObliqueAngle();
1081}
1082
1083using FontStretch = StyleFontStretch;
1084using FontSlantStyle = StyleFontStyle;
1085using FontWeight = StyleFontWeight;
1086
1087template <>
1088inline double StyleComputedTimingFunction::At(double aPortion,
1089 bool aBeforeFlag) const {
1090 return Servo_EasingFunctionAt(
1091 this, aPortion,
1092 aBeforeFlag ? StyleEasingBeforeFlag::Set : StyleEasingBeforeFlag::Unset);
1093}
1094
1095template <>
1096inline void StyleComputedTimingFunction::AppendToString(
1097 nsACString& aOut) const {
1098 return Servo_SerializeEasing(this, &aOut);
1099}
1100
1101template <>
1102inline double StyleComputedTimingFunction::GetPortion(
1103 const Maybe<StyleComputedTimingFunction>& aFn, double aPortion,
1104 bool aBeforeFlag) {
1105 return aFn ? aFn->At(aPortion, aBeforeFlag) : aPortion;
1106}
1107
1108/* static */
1109template <>
1110inline LengthPercentageOrAuto LengthPercentageOrAuto::Zero() {
1111 return LengthPercentage(LengthPercentage::Zero());
1112}
1113
1114template <>
1115inline StyleViewTimelineInset::StyleGenericViewTimelineInset()
1116 : start(LengthPercentageOrAuto::Auto()),
1117 end(LengthPercentageOrAuto::Auto()) {}
1118
1119inline StyleDisplayOutside StyleDisplay::Outside() const {
1120 return StyleDisplayOutside((_0 & OUTSIDE_MASK) >> OUTSIDE_SHIFT);
1121}
1122
1123inline StyleDisplayInside StyleDisplay::Inside() const {
1124 return StyleDisplayInside(_0 & INSIDE_MASK);
1125}
1126
1127inline bool StyleDisplay::IsListItem() const { return _0 & LIST_ITEM_MASK; }
1128
1129inline bool StyleDisplay::IsInternalTable() const {
1130 return Outside() == StyleDisplayOutside::InternalTable;
1131}
1132
1133inline bool StyleDisplay::IsInternalTableExceptCell() const {
1134 return IsInternalTable() && *this != TableCell;
1135}
1136
1137inline bool StyleDisplay::IsInternalRuby() const {
1138 return Outside() == StyleDisplayOutside::InternalRuby;
1139}
1140
1141inline bool StyleDisplay::IsRuby() const {
1142 return Inside() == StyleDisplayInside::Ruby || IsInternalRuby();
1143}
1144
1145inline bool StyleDisplay::IsInlineFlow() const {
1146 return Outside() == StyleDisplayOutside::Inline &&
1147 Inside() == StyleDisplayInside::Flow;
1148}
1149
1150inline bool StyleDisplay::IsInlineInside() const {
1151 return IsInlineFlow() || IsRuby();
1152}
1153
1154inline bool StyleDisplay::IsInlineOutside() const {
1155 return Outside() == StyleDisplayOutside::Inline || IsInternalRuby();
1156}
1157
1158inline float StyleZoom::Zoom(float aValue) const {
1159 if (*this == ONE) {
1160 return aValue;
1161 }
1162 return ToFloat() * aValue;
1163}
1164
1165inline float StyleZoom::Unzoom(float aValue) const {
1166 if (*this == ONE) {
1167 return aValue;
1168 }
1169 return aValue / ToFloat();
1170}
1171
1172inline nscoord StyleZoom::ZoomCoord(nscoord aValue) const {
1173 if (*this == ONE) {
1174 return aValue;
1175 }
1176 return NSToCoordRoundWithClamp(Zoom(float(aValue)));
1177}
1178
1179inline nscoord StyleZoom::UnzoomCoord(nscoord aValue) const {
1180 if (*this == ONE) {
1181 return aValue;
1182 }
1183 return NSToCoordRoundWithClamp(Unzoom(float(aValue)));
1184}
1185
1186inline nsSize StyleZoom::Zoom(const nsSize& aValue) const {
1187 if (*this == ONE) {
1188 return aValue;
1189 }
1190 return nsSize(ZoomCoord(aValue.Width()), ZoomCoord(aValue.Height()));
1191}
1192
1193inline nsSize StyleZoom::Unzoom(const nsSize& aValue) const {
1194 if (*this == ONE) {
1195 return aValue;
1196 }
1197 return nsSize(UnzoomCoord(aValue.Width()), UnzoomCoord(aValue.Height()));
1198}
1199
1200inline nsPoint StyleZoom::Zoom(const nsPoint& aValue) const {
1201 if (*this == ONE) {
1202 return aValue;
1203 }
1204 return nsPoint(ZoomCoord(aValue.X()), ZoomCoord(aValue.Y()));
1205}
1206
1207inline nsPoint StyleZoom::Unzoom(const nsPoint& aValue) const {
1208 if (*this == ONE) {
1209 return aValue;
1210 }
1211 return nsPoint(UnzoomCoord(aValue.X()), UnzoomCoord(aValue.Y()));
1212}
1213
1214inline nsRect StyleZoom::Zoom(const nsRect& aValue) const {
1215 if (*this == ONE) {
1216 return aValue;
1217 }
1218 return nsRect(ZoomCoord(aValue.X()), ZoomCoord(aValue.Y()),
1219 ZoomCoord(aValue.Width()), ZoomCoord(aValue.Height()));
1220}
1221
1222inline nsRect StyleZoom::Unzoom(const nsRect& aValue) const {
1223 if (*this == ONE) {
1224 return aValue;
1225 }
1226 return nsRect(UnzoomCoord(aValue.X()), UnzoomCoord(aValue.Y()),
1227 UnzoomCoord(aValue.Width()), UnzoomCoord(aValue.Height()));
1228}
1229
1230template <>
1231inline gfx::Point StyleCoordinatePair<StyleCSSFloat>::ToGfxPoint(
1232 const CSSSize* aBasis) const {
1233 return gfx::Point(x, y);
1234}
1235
1236template <>
1237inline gfx::Point StyleCoordinatePair<LengthPercentage>::ToGfxPoint(
1238 const CSSSize* aBasis) const {
1239 MOZ_ASSERT(aBasis)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aBasis)>::isValid, "invalid assertion condition")
; if ((__builtin_expect(!!(!(!!(aBasis))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("aBasis", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsInlines.h"
, 1239); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aBasis" ")"
); do { *((volatile int*)__null) = 1239; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
1240 return gfx::Point(x.ResolveToCSSPixels(aBasis->Width()),
1241 y.ResolveToCSSPixels(aBasis->Height()));
1242}
1243
1244} // namespace mozilla
1245
1246#endif

/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsForwards.h

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5/*
6 * This file contains forward declarations and typedefs for types that cbindgen
7 * cannot understand but renames / prefixes, and includes for some of the types
8 * it needs.
9 */
10
11#ifndef mozilla_ServoStyleConsts_h
12# error "This file is only meant to be included from ServoStyleConsts.h"
13#endif
14
15#ifndef mozilla_ServoStyleConstsForwards_h
16# define mozilla_ServoStyleConstsForwards_h
17
18# include "nsColor.h"
19# include "nsCoord.h"
20# include "mozilla/AtomArray.h"
21# include "mozilla/IntegerRange.h"
22# include "mozilla/Span.h"
23# include "Units.h"
24# include "mozilla/gfx/Types.h"
25# include "mozilla/CORSMode.h"
26# include "mozilla/MemoryReporting.h"
27# include "mozilla/ServoTypes.h"
28# include "mozilla/ServoBindingTypes.h"
29# include "mozilla/Vector.h"
30# include "nsCSSPropertyID.h"
31# include "nsCompatibility.h"
32# include "nsIURI.h"
33# include "mozilla/image/Resolution.h"
34# include <atomic>
35
36struct RawServoAnimationValueTable;
37
38class nsAtom;
39class nsIFrame;
40class nsINode;
41class nsIContent;
42class nsCSSPropertyIDSet;
43class nsPresContext;
44class nsSimpleContentList;
45class imgRequestProxy;
46struct nsCSSValueSharedList;
47
48class gfxFontFeatureValueSet;
49struct GeckoFontMetrics;
50namespace mozilla {
51
52// Forward declaration for `StyleLengthPercentageUnion::AsCalc`, which
53// references the type below in the generated code.
54struct StyleCalcLengthPercentage;
55
56namespace gfx {
57struct FontVariation;
58struct FontFeature;
59} // namespace gfx
60} // namespace mozilla
61using gfxFontVariation = mozilla::gfx::FontVariation;
62using gfxFontFeature = mozilla::gfx::FontFeature;
63
64enum nsCSSUnit : uint32_t;
65enum nsChangeHint : uint32_t;
66
67namespace nsStyleTransformMatrix {
68enum class MatrixTransformOperator : uint8_t;
69}
70
71template <typename T>
72class nsMainThreadPtrHolder;
73
74namespace mozilla {
75
76class ComputedStyle;
77
78using Matrix4x4Components = float[16];
79using StyleMatrix4x4Components = Matrix4x4Components;
80
81// This is sound because std::num::NonZeroUsize is repr(transparent).
82//
83// It is just the case that cbindgen doesn't understand it natively.
84using StyleNonZeroUsize = uintptr_t;
85
86struct Keyframe;
87struct PropertyStyleAnimationValuePair;
88
89using ComputedKeyframeValues = nsTArray<PropertyStyleAnimationValuePair>;
90
91class ComputedStyle;
92enum class LogicalAxis : uint8_t;
93class SeenPtrs;
94class SharedFontList;
95class StyleSheet;
96class WritingMode;
97class ServoElementSnapshotTable;
98class StyleParserState;
99
100template <typename T>
101struct StyleForgottenArcSlicePtr;
102
103struct AnimatedPropertyID;
104struct AnimationPropertySegment;
105struct AspectRatio;
106struct ComputedTiming;
107struct URLExtraData;
108
109enum HalfCorner : uint8_t;
110enum class LogicalSide : uint8_t;
111enum class PseudoStyleType : uint8_t;
112enum class OriginFlags : uint8_t;
113enum class UseBoxSizing : uint8_t;
114
115namespace css {
116class Loader;
117class LoaderReusableStyleSheets;
118class SheetLoadData;
119using SheetLoadDataHolder = nsMainThreadPtrHolder<SheetLoadData>;
120enum SheetParsingMode : uint8_t;
121} // namespace css
122
123namespace dom {
124enum class IterationCompositeOperation : uint8_t;
125enum class CallerType : uint32_t;
126
127class Element;
128class Document;
129class ImageTracker;
130
131} // namespace dom
132
133// Replacement for a Rust Box<T> for a non-dynamically-sized-type.
134//
135// TODO(emilio): If this was some sort of nullable box then this could be made
136// to work with moves, and also reduce memory layout size of stuff, potentially.
137template <typename T>
138struct StyleBox {
139 explicit StyleBox(UniquePtr<T> aPtr) : mRaw(aPtr.release()) {
140 MOZ_DIAGNOSTIC_ASSERT(mRaw)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mRaw)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(mRaw))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("mRaw", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsForwards.h"
, 140); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "mRaw"
")"); do { *((volatile int*)__null) = 140; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
141 }
142
143 ~StyleBox() {
144 MOZ_DIAGNOSTIC_ASSERT(mRaw)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mRaw)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(mRaw))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("mRaw", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsForwards.h"
, 144); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "mRaw"
")"); do { *((volatile int*)__null) = 144; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
10
Assuming field 'mRaw' is non-null
11
Taking false branch
12
Loop condition is false. Exiting loop
17
Assuming field 'mRaw' is non-null
18
Taking false branch
19
Loop condition is false. Exiting loop
28
Taking false branch
29
Loop condition is false. Exiting loop
145 delete mRaw;
13
Calling '~StyleGenericCalcNode'
20
Calling 'operator delete'
22
Returning from 'operator delete'
30
Attempt to delete released memory
146 }
147
148 StyleBox(const StyleBox& aOther) : StyleBox(MakeUnique<T>(*aOther)) {}
149
150 StyleBox& operator=(const StyleBox& aOther) const {
151 delete mRaw;
152 mRaw = MakeUnique<T>(*aOther).release();
153 return *this;
154 }
155
156 const T* operator->() const {
157 MOZ_DIAGNOSTIC_ASSERT(mRaw)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mRaw)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(mRaw))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("mRaw", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsForwards.h"
, 157); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "mRaw"
")"); do { *((volatile int*)__null) = 157; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
158 return mRaw;
159 }
160
161 const T& operator*() const {
162 MOZ_DIAGNOSTIC_ASSERT(mRaw)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mRaw)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(mRaw))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("mRaw", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsForwards.h"
, 162); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "mRaw"
")"); do { *((volatile int*)__null) = 162; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
163 return *mRaw;
164 }
165
166 T* operator->() {
167 MOZ_DIAGNOSTIC_ASSERT(mRaw)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mRaw)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(mRaw))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("mRaw", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsForwards.h"
, 167); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "mRaw"
")"); do { *((volatile int*)__null) = 167; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
168 return mRaw;
169 }
170
171 T& operator*() {
172 MOZ_DIAGNOSTIC_ASSERT(mRaw)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(mRaw)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(mRaw))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("mRaw", "/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/ServoStyleConstsForwards.h"
, 172); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "mRaw"
")"); do { *((volatile int*)__null) = 172; __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
173 return *mRaw;
174 }
175
176 bool operator==(const StyleBox& aOther) const { return *(*this) == *aOther; }
177
178 bool operator!=(const StyleBox& aOther) const { return *(*this) != *aOther; }
179
180 private:
181 T* mRaw;
182};
183
184// Work-around weird cbindgen renaming / avoiding moving stuff outside its
185// namespace.
186
187using StyleImageTracker = dom::ImageTracker;
188using StyleLoader = css::Loader;
189using StyleLoaderReusableStyleSheets = css::LoaderReusableStyleSheets;
190using StyleCallerType = dom::CallerType;
191using StyleSheetParsingMode = css::SheetParsingMode;
192using StyleSheetLoadData = css::SheetLoadData;
193using StyleSheetLoadDataHolder = css::SheetLoadDataHolder;
194using StyleGeckoMallocSizeOf = MallocSizeOf;
195using StyleDomStyleSheet = StyleSheet;
196
197using StyleRawGeckoNode = nsINode;
198using StyleRawGeckoElement = dom::Element;
199using StyleDocument = dom::Document;
200using StyleComputedValues = ComputedStyle;
201using StyleIterationCompositeOperation = dom::IterationCompositeOperation;
202
203using StyleMatrixTransformOperator =
204 nsStyleTransformMatrix::MatrixTransformOperator;
205
206# define SERVO_LOCKED_ARC_TYPE(name_) struct StyleLocked##type_;
207# include "mozilla/ServoLockedArcTypeList.h"
208# undef SERVO_LOCKED_ARC_TYPE
209
210# define SERVO_BOXED_TYPE(name_, type_) struct Style##type_;
211# include "mozilla/ServoBoxedTypeList.h"
212# undef SERVO_BOXED_TYPE
213
214using StyleAtomicUsize = std::atomic<size_t>;
215
216# define SERVO_FIXED_POINT_HELPERS(T, RawT, FractionBits)static constexpr RawT kPointFive = 1 << (FractionBits -
1); static constexpr uint16_t kScale = 1 << FractionBits
; static constexpr float kInverseScale = 1.0f / kScale; static
T FromRaw(RawT aRaw) { return {{aRaw}}; } static T FromFloat
(float aFloat) { return FromRaw(RawT(aFloat * kScale)); } static
T FromInt(RawT aInt) { return FromRaw(RawT(aInt * kScale)); }
RawT Raw() const { return _0.value; } uint16_t UnsignedRaw()
const { return uint16_t(Raw()); } float ToFloat() const { return
Raw() * kInverseScale; } RawT ToIntRounded() const { return (
Raw() + kPointFive) >> FractionBits; } inline void ToString
(nsACString&) const;
\
217 static constexpr RawT kPointFive = 1 << (FractionBits - 1); \
218 static constexpr uint16_t kScale = 1 << FractionBits; \
219 static constexpr float kInverseScale = 1.0f / kScale; \
220 static T FromRaw(RawT aRaw) { return {{aRaw}}; } \
221 static T FromFloat(float aFloat) { \
222 return FromRaw(RawT(aFloat * kScale)); \
223 } \
224 static T FromInt(RawT aInt) { return FromRaw(RawT(aInt * kScale)); } \
225 RawT Raw() const { return _0.value; } \
226 uint16_t UnsignedRaw() const { return uint16_t(Raw()); } \
227 float ToFloat() const { return Raw() * kInverseScale; } \
228 RawT ToIntRounded() const { return (Raw() + kPointFive) >> FractionBits; } \
229 inline void ToString(nsACString&) const;
230
231} // namespace mozilla
232
233# ifndef HAVE_64BIT_BUILD1
234static_assert(sizeof(void*) == 4, "");
235# define SERVO_32_BITS 1
236# endif
237# define CBINDGEN_IS_GECKO
238
239#endif

/var/lib/jenkins/workspace/firefox-scan-build/obj-x86_64-pc-linux-gnu/dist/include/mozilla/cxxalloc.h

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5#ifndef mozilla_cxxalloc_h
6#define mozilla_cxxalloc_h
7
8/*
9 * We implement the default operators new/delete as part of
10 * libmozalloc, replacing their definitions in libstdc++. The
11 * operator new* definitions in libmozalloc will never return a NULL
12 * pointer.
13 *
14 * Each operator new immediately below returns a pointer to memory
15 * that can be delete'd by any of
16 *
17 * (1) the matching infallible operator delete immediately below
18 * (2) the matching system |operator delete(void*, std::nothrow)|
19 * (3) the matching system |operator delete(void*) noexcept(false)|
20 *
21 * NB: these are declared |noexcept(false)|, though they will never
22 * throw that exception. This declaration is consistent with the rule
23 * that |::operator new() noexcept(false)| will never return NULL.
24 *
25 * NB: mozilla::fallible can be used instead of std::nothrow.
26 */
27
28#ifndef MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline
29# define MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline MFBT_API__attribute__((weak)) __attribute__((visibility("default")))
30#endif
31
32MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline void* operator new(size_t size) noexcept(false) {
33 return moz_xmalloc(size);
34}
35
36MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline void* operator new(size_t size,
37 const std::nothrow_t&) noexcept(true) {
38 return malloc_implmalloc(size);
39}
40
41MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline void* operator new[](size_t size) noexcept(false) {
42 return moz_xmalloc(size);
43}
44
45MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline void* operator new[](size_t size,
46 const std::nothrow_t&) noexcept(true) {
47 return malloc_implmalloc(size);
48}
49
50MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline void operator delete(void* ptr) noexcept(true) {
51 return free_implfree(ptr);
21
Memory is released
52}
53
54MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline void operator delete(void* ptr,
55 const std::nothrow_t&) noexcept(true) {
56 return free_implfree(ptr);
57}
58
59MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline void operator delete[](void* ptr) noexcept(true) {
60 return free_implfree(ptr);
61}
62
63MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline void operator delete[](
64 void* ptr, const std::nothrow_t&) noexcept(true) {
65 return free_implfree(ptr);
66}
67
68#if defined(XP_WIN)
69// We provide the global sized delete overloads unconditionally because the
70// MSVC runtime headers do, despite compiling with /Zc:sizedDealloc-
71MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline void operator delete(void* ptr,
72 size_t /*size*/) noexcept(true) {
73 return free_implfree(ptr);
74}
75
76MOZALLOC_EXPORT_NEW__attribute__((always_inline)) inline void operator delete[](void* ptr,
77 size_t /*size*/) noexcept(true) {
78 return free_implfree(ptr);
79}
80#endif
81
82#endif /* mozilla_cxxalloc_h */