Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / gfx / thebes / public / gfxTextRunWordCache.h
blob9375192f6bbf2ad4da6ae26655d0db0f9b7404f3
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Mozilla Foundation code.
17 * The Initial Developer of the Original Code is Mozilla Foundation.
18 * Portions created by the Initial Developer are Copyright (C) 2006
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
22 * Vladimir Vukicevic <vladimir@pobox.com>
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef GFX_TEXT_RUN_WORD_CACHE_H
39 #define GFX_TEXT_RUN_WORD_CACHE_H
41 #include "gfxFont.h"
43 /**
44 * Cache individual "words" (strings delimited by white-space or white-space-like
45 * characters that don't involve kerning or ligatures) in textruns.
47 class THEBES_API gfxTextRunWordCache {
48 public:
49 enum {
50 TEXT_IN_CACHE = 0x10000000,
51 /**
52 * When set, the previous character for this textrun was an Arabic
53 * character. This is used for the context detection necessary for
54 * bidi.numeral implementation.
56 TEXT_INCOMING_ARABICCHAR = 0x10000000
59 /**
60 * Create a textrun using cached words.
61 * Invalid characters (see gfxFontGroup::IsInvalidChar) will be automatically
62 * treated as invisible missing.
63 * @param aFlags the flags TEXT_IS_ASCII and TEXT_HAS_SURROGATES must be set
64 * by the caller, if applicable; TEXT_IN_CACHE is added if we
65 * have a reference to the textrun in the cache and RemoveTextRun must
66 * be called when the textrun dies.
68 static gfxTextRun *MakeTextRun(const PRUnichar *aText, PRUint32 aLength,
69 gfxFontGroup *aFontGroup,
70 const gfxFontGroup::Parameters *aParams,
71 PRUint32 aFlags);
72 /**
73 * Create a textrun using cached words.
74 * Invalid characters (see gfxFontGroup::IsInvalidChar) will be automatically
75 * treated as invisible missing.
76 * @param aFlags the flags TEXT_IS_ASCII and TEXT_HAS_SURROGATES must be set
77 * by the caller, if applicable; TEXT_IN_CACHE is added if we
78 * have a reference to the textrun in the cache and RemoveTextRun must
79 * be called when the textrun dies.
81 static gfxTextRun *MakeTextRun(const PRUint8 *aText, PRUint32 aLength,
82 gfxFontGroup *aFontGroup,
83 const gfxFontGroup::Parameters *aParams,
84 PRUint32 aFlags);
86 /**
87 * Remove a textrun from the cache. This must be called before aTextRun
88 * is deleted! The text in the textrun must still be valid.
90 static void RemoveTextRun(gfxTextRun *aTextRun);
92 protected:
93 friend class gfxPlatform;
95 static nsresult Init();
96 static void Shutdown();
99 #endif /* GFX_TEXT_RUN_WORD_CACHE_H */