Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / gfx / thebes / public / gfxTextRunWordCache.h
blob99015a821f0f1895826d61e7f6868542cd164e76
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 { TEXT_IN_CACHE = 0x10000000 };
51 /**
52 * Create a textrun using cached words.
53 * Invalid characters (see gfxFontGroup::IsInvalidChar) will be automatically
54 * treated as invisible missing.
55 * @param aFlags the flags TEXT_IS_ASCII and TEXT_HAS_SURROGATES must be set
56 * by the caller, if applicable; TEXT_IN_CACHE is added if we
57 * have a reference to the textrun in the cache and RemoveTextRun must
58 * be called when the textrun dies.
60 static gfxTextRun *MakeTextRun(const PRUnichar *aText, PRUint32 aLength,
61 gfxFontGroup *aFontGroup,
62 const gfxFontGroup::Parameters *aParams,
63 PRUint32 aFlags);
64 /**
65 * Create a textrun using cached words.
66 * Invalid characters (see gfxFontGroup::IsInvalidChar) will be automatically
67 * treated as invisible missing.
68 * @param aFlags the flags TEXT_IS_ASCII and TEXT_HAS_SURROGATES must be set
69 * by the caller, if applicable; TEXT_IN_CACHE is added if we
70 * have a reference to the textrun in the cache and RemoveTextRun must
71 * be called when the textrun dies.
73 static gfxTextRun *MakeTextRun(const PRUint8 *aText, PRUint32 aLength,
74 gfxFontGroup *aFontGroup,
75 const gfxFontGroup::Parameters *aParams,
76 PRUint32 aFlags);
78 /**
79 * Remove a textrun from the cache. This must be called before aTextRun
80 * is deleted! The text in the textrun must still be valid.
82 static void RemoveTextRun(gfxTextRun *aTextRun);
84 protected:
85 friend class gfxPlatform;
87 static nsresult Init();
88 static void Shutdown();
91 #endif /* GFX_TEXT_RUN_WORD_CACHE_H */