OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 13 matching lines...) Expand all Loading... |
24 #define InlineTextBox_h | 24 #define InlineTextBox_h |
25 | 25 |
26 #include "core/rendering/InlineBox.h" | 26 #include "core/rendering/InlineBox.h" |
27 #include "core/rendering/RenderText.h" // so textRenderer() can be inline | 27 #include "core/rendering/RenderText.h" // so textRenderer() can be inline |
28 #include "platform/graphics/GraphicsContext.h" | 28 #include "platform/graphics/GraphicsContext.h" |
29 #include "platform/text/TextRun.h" | 29 #include "platform/text/TextRun.h" |
30 #include "wtf/Forward.h" | 30 #include "wtf/Forward.h" |
31 | 31 |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
| 34 class AppliedTextDecoration; |
34 struct CompositionUnderline; | 35 struct CompositionUnderline; |
35 class DocumentMarker; | 36 class DocumentMarker; |
| 37 struct PaintAppliedDecorationData; |
36 | 38 |
37 const unsigned short cNoTruncation = USHRT_MAX; | 39 const unsigned short cNoTruncation = USHRT_MAX; |
38 const unsigned short cFullTruncation = USHRT_MAX - 1; | 40 const unsigned short cFullTruncation = USHRT_MAX - 1; |
39 | 41 |
40 // Helper functions shared by InlineTextBox / SVGRootInlineBox | 42 // Helper functions shared by InlineTextBox / SVGRootInlineBox |
41 void updateGraphicsContext(GraphicsContext*, const Color& fillColor, const Color
& strokeColor, float strokeThickness, ColorSpace); | 43 void updateGraphicsContext(GraphicsContext*, const Color& fillColor, const Color
& strokeColor, float strokeThickness, ColorSpace); |
42 Color correctedTextColor(Color textColor, Color backgroundColor); | 44 Color correctedTextColor(Color textColor, Color backgroundColor); |
43 | 45 |
44 class InlineTextBox : public InlineBox { | 46 class InlineTextBox : public InlineBox { |
45 public: | 47 public: |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 protected: | 180 protected: |
179 void paintCompositionBackground(GraphicsContext*, const FloatPoint& boxOrigi
n, RenderStyle*, const Font&, int startPos, int endPos); | 181 void paintCompositionBackground(GraphicsContext*, const FloatPoint& boxOrigi
n, RenderStyle*, const Font&, int startPos, int endPos); |
180 void paintDocumentMarkers(GraphicsContext*, const FloatPoint& boxOrigin, Ren
derStyle*, const Font&, bool background); | 182 void paintDocumentMarkers(GraphicsContext*, const FloatPoint& boxOrigin, Ren
derStyle*, const Font&, bool background); |
181 void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin
, const CompositionUnderline&); | 183 void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin
, const CompositionUnderline&); |
182 | 184 |
183 // These functions both paint markers and update the DocumentMarker's render
edRect. | 185 // These functions both paint markers and update the DocumentMarker's render
edRect. |
184 virtual void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrig
in, DocumentMarker*, RenderStyle*, const Font&, bool grammar); | 186 virtual void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrig
in, DocumentMarker*, RenderStyle*, const Font&, bool grammar); |
185 virtual void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOri
gin, DocumentMarker*, RenderStyle*, const Font&); | 187 virtual void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOri
gin, DocumentMarker*, RenderStyle*, const Font&); |
186 | 188 |
187 private: | 189 private: |
188 void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, TextDeco
ration, const ShadowList*); | 190 int computeUnderlineOffset(RenderStyle*, float textDecorationThickness); |
| 191 void paintAppliedDecoration(GraphicsContext*, const RenderObject::ResolvedDe
coration&, const PaintAppliedDecorationData&); |
| 192 void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, RenderSt
yle*, const ShadowList*); |
189 void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderSty
le*, const Font&, Color textColor); | 193 void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderSty
le*, const Font&, Color textColor); |
190 | 194 |
191 TextRun::ExpansionBehavior expansionBehavior() const | 195 TextRun::ExpansionBehavior expansionBehavior() const |
192 { | 196 { |
193 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex
tRun::ForbidLeadingExpansion) | 197 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex
tRun::ForbidLeadingExpansion) |
194 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion
: TextRun::ForbidTrailingExpansion); | 198 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion
: TextRun::ForbidTrailingExpansion); |
195 } | 199 } |
196 }; | 200 }; |
197 | 201 |
198 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); | 202 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); |
199 | 203 |
200 inline RenderText& InlineTextBox::textRenderer() const | 204 inline RenderText& InlineTextBox::textRenderer() const |
201 { | 205 { |
202 return toRenderText(renderer()); | 206 return toRenderText(renderer()); |
203 } | 207 } |
204 | 208 |
205 void alignSelectionRectToDevicePixels(FloatRect&); | 209 void alignSelectionRectToDevicePixels(FloatRect&); |
206 | 210 |
207 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio
nDirection rotationDirection) | 211 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio
nDirection rotationDirection) |
208 { | 212 { |
209 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect
.x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) | 213 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect
.x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) |
210 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x()
+ boxRect.maxY()); | 214 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x()
+ boxRect.maxY()); |
211 } | 215 } |
212 | 216 |
213 } // namespace WebCore | 217 } // namespace WebCore |
214 | 218 |
215 #endif // InlineTextBox_h | 219 #endif // InlineTextBox_h |
OLD | NEW |