diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /gfx/thebes/gfxFontSrcURI.h | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/thebes/gfxFontSrcURI.h')
-rw-r--r-- | gfx/thebes/gfxFontSrcURI.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/gfx/thebes/gfxFontSrcURI.h b/gfx/thebes/gfxFontSrcURI.h new file mode 100644 index 0000000000..226341e5fd --- /dev/null +++ b/gfx/thebes/gfxFontSrcURI.h @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MOZILLA_GFX_FONTSRCURI_H +#define MOZILLA_GFX_FONTSRCURI_H + +#include "nsCOMPtr.h" +#include "nsTString.h" +#include "PLDHashTable.h" + +class nsIURI; + +namespace mozilla { +namespace net { +class nsSimpleURI; +} // namespace net +} // namespace mozilla + +/** + * A wrapper for an nsIURI that can be used OMT, which has cached information + * useful for the gfxUserFontSet. + */ +class gfxFontSrcURI { + public: + explicit gfxFontSrcURI(nsIURI* aURI); + + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(gfxFontSrcURI) + + nsIURI* get() { return mURI; } + + bool Equals(gfxFontSrcURI* aOther); + nsresult GetSpec(nsACString& aResult); + nsCString GetSpecOrDefault(); + + PLDHashNumber Hash() const { return mHash; } + bool InheritsSecurityContext() const { return mInheritsSecurityContext; } + bool SyncLoadIsOK() const { return mSyncLoadIsOK; } + + private: + ~gfxFontSrcURI(); + + // The URI. + nsCOMPtr<nsIURI> mURI; + + // If the nsIURI is an nsSimpleURI for a data: URL, this is a pointer to it. + // (Just a weak reference since mURI holds the strong reference.) + // + // We store this so that we don't duplicate the URL spec for data: URLs, + // which can be much larger than other URLs. + mozilla::net::nsSimpleURI* mSimpleURI; + + // If the nsIURI is not an nsSimpleURI, this is its spec. + nsCString mSpec; + + // Precomputed hash for mURI. + PLDHashNumber mHash; + + // Whether the nsIURI's protocol handler has the URI_INHERITS_SECURITY_CONTEXT + // flag. + bool mInheritsSecurityContext; + + // Whether the nsIURI's protocol handler has teh URI_SYNC_LOAD_IS_OK flag. + bool mSyncLoadIsOK; +}; + +#endif // MOZILLA_GFX_FONTSRCURI_H |