| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 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, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // being reasonably safe (because inherited fonts in the render tree pick up
the new | 149 // being reasonably safe (because inherited fonts in the render tree pick up
the new |
| 150 // style anyway. Other copies are transient, e.g., the state in the Graphics
Context, and | 150 // style anyway. Other copies are transient, e.g., the state in the Graphics
Context, and |
| 151 // won't stick around long enough to get you in trouble). Still, this is pre
tty disgusting, | 151 // won't stick around long enough to get you in trouble). Still, this is pre
tty disgusting, |
| 152 // and could eventually be rectified by using RefPtrs for Fonts themselves. | 152 // and could eventually be rectified by using RefPtrs for Fonts themselves. |
| 153 if (!m_fontFallbackList) | 153 if (!m_fontFallbackList) |
| 154 m_fontFallbackList = FontFallbackList::create(); | 154 m_fontFallbackList = FontFallbackList::create(); |
| 155 m_fontFallbackList->invalidate(fontSelector); | 155 m_fontFallbackList->invalidate(fontSelector); |
| 156 m_typesettingFeatures = computeTypesettingFeatures(); | 156 m_typesettingFeatures = computeTypesettingFeatures(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoi
nt& point, int from, int to, CustomFontNotReadyAction customFontNotReadyAction)
const | 159 void Font::drawText(GraphicsContext* context, const TextRunPaintInfo& runInfo, c
onst FloatPoint& point, CustomFontNotReadyAction customFontNotReadyAction) const |
| 160 { | 160 { |
| 161 // Don't draw anything while we are using custom fonts that are in the proce
ss of loading, | 161 // Don't draw anything while we are using custom fonts that are in the proce
ss of loading, |
| 162 // except if the 'force' argument is set to true (in which case it will use
a fallback | 162 // except if the 'force' argument is set to true (in which case it will use
a fallback |
| 163 // font). | 163 // font). |
| 164 if (loadingCustomFonts() && customFontNotReadyAction == DoNotPaintIfFontNotR
eady) | 164 if (loadingCustomFonts() && customFontNotReadyAction == DoNotPaintIfFontNotR
eady) |
| 165 return; | 165 return; |
| 166 | 166 |
| 167 to = (to == -1 ? run.length() : to); | 167 CodePath codePathToUse = codePath(runInfo.run); |
| 168 | |
| 169 CodePath codePathToUse = codePath(run); | |
| 170 // FIXME: Use the fast code path once it handles partial runs with kerning a
nd ligatures. See http://webkit.org/b/100050 | 168 // FIXME: Use the fast code path once it handles partial runs with kerning a
nd ligatures. See http://webkit.org/b/100050 |
| 171 if (codePathToUse != Complex && typesettingFeatures() && (from || to != run.
length())) | 169 if (codePathToUse != Complex && typesettingFeatures() && (runInfo.from || ru
nInfo.to != runInfo.run.length())) |
| 172 codePathToUse = Complex; | 170 codePathToUse = Complex; |
| 173 | 171 |
| 174 if (codePathToUse != Complex) | 172 if (codePathToUse != Complex) |
| 175 return drawSimpleText(context, run, point, from, to); | 173 return drawSimpleText(context, runInfo, point); |
| 176 | 174 |
| 177 return drawComplexText(context, run, point, from, to); | 175 return drawComplexText(context, runInfo, point); |
| 178 } | 176 } |
| 179 | 177 |
| 180 void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const
AtomicString& mark, const FloatPoint& point, int from, int to) const | 178 void Font::drawEmphasisMarks(GraphicsContext* context, const TextRunPaintInfo& r
unInfo, const AtomicString& mark, const FloatPoint& point) const |
| 181 { | 179 { |
| 182 if (loadingCustomFonts()) | 180 if (loadingCustomFonts()) |
| 183 return; | 181 return; |
| 184 | 182 |
| 185 if (to < 0) | 183 CodePath codePathToUse = codePath(runInfo.run); |
| 186 to = run.length(); | |
| 187 | |
| 188 CodePath codePathToUse = codePath(run); | |
| 189 // FIXME: Use the fast code path once it handles partial runs with kerning a
nd ligatures. See http://webkit.org/b/100050 | 184 // FIXME: Use the fast code path once it handles partial runs with kerning a
nd ligatures. See http://webkit.org/b/100050 |
| 190 if (codePathToUse != Complex && typesettingFeatures() && (from || to != run.
length())) | 185 if (codePathToUse != Complex && typesettingFeatures() && (runInfo.from || ru
nInfo.to != runInfo.run.length())) |
| 191 codePathToUse = Complex; | 186 codePathToUse = Complex; |
| 192 | 187 |
| 193 if (codePathToUse != Complex) | 188 if (codePathToUse != Complex) |
| 194 drawEmphasisMarksForSimpleText(context, run, mark, point, from, to); | 189 drawEmphasisMarksForSimpleText(context, runInfo, mark, point); |
| 195 else | 190 else |
| 196 drawEmphasisMarksForComplexText(context, run, mark, point, from, to); | 191 drawEmphasisMarksForComplexText(context, runInfo, mark, point); |
| 197 } | 192 } |
| 198 | 193 |
| 199 float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo
nts, GlyphOverflow* glyphOverflow) const | 194 float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo
nts, GlyphOverflow* glyphOverflow) const |
| 200 { | 195 { |
| 201 CodePath codePathToUse = codePath(run); | 196 CodePath codePathToUse = codePath(run); |
| 202 if (codePathToUse != Complex) { | 197 if (codePathToUse != Complex) { |
| 203 // The complex path is more restrictive about returning fallback fonts t
han the simple path, so we need an explicit test to make their behaviors match. | 198 // The complex path is more restrictive about returning fallback fonts t
han the simple path, so we need an explicit test to make their behaviors match. |
| 204 if (!canReturnFallbackFontsForComplexText()) | 199 if (!canReturnFallbackFontsForComplexText()) |
| 205 fallbackFonts = 0; | 200 fallbackFonts = 0; |
| 206 // The simple path can optimize the case where glyph overflow is not obs
ervable. | 201 // The simple path can optimize the case where glyph overflow is not obs
ervable. |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 | 793 |
| 799 // Additional word-separator characters listed in CSS Text Level 3 Editor's
Draft 3 November 2010. | 794 // Additional word-separator characters listed in CSS Text Level 3 Editor's
Draft 3 November 2010. |
| 800 if (c == ethiopicWordspace || c == aegeanWordSeparatorLine || c == aegeanWor
dSeparatorDot | 795 if (c == ethiopicWordspace || c == aegeanWordSeparatorLine || c == aegeanWor
dSeparatorDot |
| 801 || c == ugariticWordDivider || c == tibetanMarkIntersyllabicTsheg || c =
= tibetanMarkDelimiterTshegBstar) | 796 || c == ugariticWordDivider || c == tibetanMarkIntersyllabicTsheg || c =
= tibetanMarkDelimiterTshegBstar) |
| 802 return false; | 797 return false; |
| 803 | 798 |
| 804 return true; | 799 return true; |
| 805 } | 800 } |
| 806 | 801 |
| 807 } | 802 } |
| OLD | NEW |