2 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 #ifndef RenderCombineText_h
22 #define RenderCombineText_h
24 #include "RenderText.h"
28 class RenderCombineText : public RenderText {
30 RenderCombineText(Node*, PassRefPtr<StringImpl>);
33 void adjustTextOrigin(FloatPoint& textOrigin, const FloatRect& boxRect) const;
34 void charactersToRender(int start, const UChar*& characters, int& length) const;
35 bool isCombined() const { return m_isCombined; }
36 float combinedTextWidth(const Font& font) const { return font.size(); }
37 const Font& originalFont() const { return parent()->style()->font(); }
40 virtual bool isCombineText() const { return true; }
41 virtual float width(unsigned from, unsigned length, const Font&, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
42 virtual const char* renderName() const { return "RenderCombineText"; }
43 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
44 virtual void setTextInternal(PassRefPtr<StringImpl>);
46 float m_combinedTextWidth;
47 bool m_isCombined : 1;
48 bool m_needsFontUpdate : 1;
51 inline RenderCombineText* toRenderCombineText(RenderObject* object)
53 ASSERT(!object || object->isCombineText());
54 return static_cast<RenderCombineText*>(object);
57 inline const RenderCombineText* toRenderCombineText(const RenderObject* object)
59 ASSERT(!object || object->isCombineText());
60 return static_cast<const RenderCombineText*>(object);
63 // This will catch anyone doing an unnecessary cast.
64 void toRenderCombineText(const RenderCombineText*);
66 } // namespace WebCore
68 #endif // RenderCombineText_h