Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2008 Holger Hans Peter Freyther | 6 * Copyright (C) 2008 Holger Hans Peter Freyther |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 bool operator!=(const Font& other) const { return !(*this == other); } | 90 bool operator!=(const Font& other) const { return !(*this == other); } |
| 91 | 91 |
| 92 const FontDescription& fontDescription() const { return m_fontDescription; } | 92 const FontDescription& fontDescription() const { return m_fontDescription; } |
| 93 | 93 |
| 94 int pixelSize() const { return fontDescription().computedPixelSize(); } | 94 int pixelSize() const { return fontDescription().computedPixelSize(); } |
| 95 float size() const { return fontDescription().computedSize(); } | 95 float size() const { return fontDescription().computedSize(); } |
| 96 | 96 |
| 97 void update(PassRefPtr<FontSelector>) const; | 97 void update(PassRefPtr<FontSelector>) const; |
| 98 | 98 |
| 99 enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontN otReady }; | 99 enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontN otReady }; |
| 100 void drawText(GraphicsContext*, const TextRun&, const FloatPoint&, int from = 0, int to = -1, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const; | 100 void drawText(GraphicsContext*, const TextRun&, const FloatPoint&, const Flo atRect& textRect, int from = 0, int to = -1, CustomFontNotReadyAction = DoNotPai ntIfFontNotReady) const; |
| 101 void drawEmphasisMarks(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1) const; | 101 void drawEmphasisMarks(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, const FloatRect& textRect, int from = 0, int to = -1) const; |
| 102 | 102 |
| 103 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; | 103 float width(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; |
| 104 float width(const TextRun&, int& charsConsumed, String& glyphName) const; | 104 float width(const TextRun&, int& charsConsumed, String& glyphName) const; |
| 105 | 105 |
| 106 PassOwnPtr<TextLayout> createLayout(RenderText*, float xPos, bool collapseWh iteSpace) const; | 106 PassOwnPtr<TextLayout> createLayout(RenderText*, float xPos, bool collapseWh iteSpace) const; |
| 107 static void deleteLayout(TextLayout*); | 107 static void deleteLayout(TextLayout*); |
| 108 static float width(TextLayout&, unsigned from, unsigned len, HashSet<const S impleFontData*>* fallbackFonts = 0); | 108 static float width(TextLayout&, unsigned from, unsigned len, HashSet<const S impleFontData*>* fallbackFonts = 0); |
| 109 | 109 |
| 110 int offsetForPosition(const TextRun&, float position, bool includePartialGly phs) const; | 110 int offsetForPosition(const TextRun&, float position, bool includePartialGly phs) const; |
| 111 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1) const; | 111 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1) const; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 enum CodePath { Auto, Simple, Complex, SimpleWithGlyphOverflow }; | 166 enum CodePath { Auto, Simple, Complex, SimpleWithGlyphOverflow }; |
| 167 CodePath codePath(const TextRun&) const; | 167 CodePath codePath(const TextRun&) const; |
| 168 static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simp le; } | 168 static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simp le; } |
| 169 static CodePath characterRangeCodePath(const UChar*, unsigned len); | 169 static CodePath characterRangeCodePath(const UChar*, unsigned len); |
| 170 | 170 |
| 171 private: | 171 private: |
| 172 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; | 172 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; |
| 173 | 173 |
| 174 // Returns the initial in-stream advance. | 174 // Returns the initial in-stream advance. |
| 175 float getGlyphsAndAdvancesForSimpleText(const TextRun&, int from, int to, Gl yphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; | 175 float getGlyphsAndAdvancesForSimpleText(const TextRun&, int from, int to, Gl yphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; |
| 176 void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; | 176 void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, con st FloatRect& textRect, int from, int to) const; |
| 177 void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, int from, int to) const; | 177 void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, const FloatRect& textRect, int from, int to) const; |
| 178 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const; | 178 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&, const FloatRect& textRect) const; |
| 179 void drawGlyphBuffer(GraphicsContext*, const TextRun&, const GlyphBuffer&, c onst FloatPoint&) const; | 179 void drawGlyphBuffer(GraphicsContext*, const TextRun&, const GlyphBuffer&, c onst FloatPoint&, const FloatRect& textRect) const; |
| 180 void drawEmphasisMarks(GraphicsContext*, const TextRun&, const GlyphBuffer&, const AtomicString&, const FloatPoint&) const; | 180 void drawEmphasisMarks(GraphicsContext*, const TextRun&, const GlyphBuffer&, const AtomicString&, const FloatPoint&, const FloatRect& textRect) const; |
|
eseidel
2013/04/18 21:04:38
The rest of these arguments would benifit from cle
alokp
2013/04/18 22:22:37
Will do in a separate patch.
| |
| 181 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*> * fallbackFonts = 0, GlyphOverflow* = 0) const; | 181 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*> * fallbackFonts = 0, GlyphOverflow* = 0) const; |
| 182 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl udePartialGlyphs) const; | 182 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl udePartialGlyphs) const; |
| 183 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int h, int from, int to) const; | 183 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int h, int from, int to) const; |
| 184 | 184 |
| 185 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; | 185 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; |
| 186 | 186 |
| 187 static bool canReturnFallbackFontsForComplexText(); | 187 static bool canReturnFallbackFontsForComplexText(); |
| 188 static bool canExpandAroundIdeographsInComplexText(); | 188 static bool canExpandAroundIdeographsInComplexText(); |
| 189 | 189 |
| 190 // Returns the initial in-stream advance. | 190 // Returns the initial in-stream advance. |
| 191 float getGlyphsAndAdvancesForComplexText(const TextRun&, int from, int to, G lyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; | 191 float getGlyphsAndAdvancesForComplexText(const TextRun&, int from, int to, G lyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; |
| 192 void drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, in t from, int to) const; | 192 void drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, co nst FloatRect& textRect, int from, int to) const; |
| 193 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, int from, int to) const; | 193 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRun&, const AtomicString& mark, const FloatPoint&, const FloatRect& textRect, int from, int to) const; |
| 194 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData* >* fallbackFonts = 0, GlyphOverflow* = 0) const; | 194 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData* >* fallbackFonts = 0, GlyphOverflow* = 0) const; |
| 195 int offsetForPositionForComplexText(const TextRun&, float position, bool inc ludePartialGlyphs) const; | 195 int offsetForPositionForComplexText(const TextRun&, float position, bool inc ludePartialGlyphs) const; |
| 196 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int h, int from, int to) const; | 196 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int h, int from, int to) const; |
| 197 | 197 |
| 198 friend struct WidthIterator; | 198 friend struct WidthIterator; |
| 199 friend class SVGTextRunRenderingContext; | 199 friend class SVGTextRunRenderingContext; |
| 200 | 200 |
| 201 public: | 201 public: |
| 202 // Useful for debugging the different font rendering code paths. | 202 // Useful for debugging the different font rendering code paths. |
| 203 static void setCodePath(CodePath); | 203 static void setCodePath(CodePath); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 | 332 |
| 333 } | 333 } |
| 334 | 334 |
| 335 namespace WTF { | 335 namespace WTF { |
| 336 | 336 |
| 337 template <> void deleteOwnedPtr<WebCore::TextLayout>(WebCore::TextLayout*); | 337 template <> void deleteOwnedPtr<WebCore::TextLayout>(WebCore::TextLayout*); |
| 338 | 338 |
| 339 } | 339 } |
| 340 | 340 |
| 341 #endif | 341 #endif |
| OLD | NEW |