diff options
Diffstat (limited to 'WebCore/rendering/SVGInlineTextBox.h')
-rw-r--r-- | WebCore/rendering/SVGInlineTextBox.h | 93 |
1 files changed, 39 insertions, 54 deletions
diff --git a/WebCore/rendering/SVGInlineTextBox.h b/WebCore/rendering/SVGInlineTextBox.h index c586ddd..77b6498 100644 --- a/WebCore/rendering/SVGInlineTextBox.h +++ b/WebCore/rendering/SVGInlineTextBox.h @@ -28,72 +28,57 @@ namespace WebCore { - class SVGRootInlineBox; +class SVGRootInlineBox; - struct SVGChar; - struct SVGTextDecorationInfo; +struct SVGChar; +struct SVGCharacterLayoutInfo; +struct SVGLastGlyphInfo; +struct SVGTextDecorationInfo; +struct SVGTextPaintInfo; - enum SVGTextPaintSubphase { - SVGTextPaintSubphaseBackground, - SVGTextPaintSubphaseGlyphFill, - SVGTextPaintSubphaseGlyphFillSelection, - SVGTextPaintSubphaseGlyphStroke, - SVGTextPaintSubphaseGlyphStrokeSelection, - SVGTextPaintSubphaseForeground - }; +class SVGInlineTextBox : public InlineTextBox { +public: + SVGInlineTextBox(RenderObject* obj); - struct SVGTextPaintInfo { - SVGTextPaintInfo() - : activePaintingResource(0) - , subphase(SVGTextPaintSubphaseBackground) - { - } + virtual int virtualHeight() const { return m_height; } + void setHeight(int h) { m_height = h; } - RenderSVGResource* activePaintingResource; - SVGTextPaintSubphase subphase; - }; + virtual int selectionTop() { return m_y; } + virtual int selectionHeight() { return m_height; } - class SVGInlineTextBox : public InlineTextBox { - public: - SVGInlineTextBox(RenderObject* obj); + virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const; + virtual int positionForOffset(int offset) const; - virtual int virtualHeight() const { return m_height; } - void setHeight(int h) { m_height = h; } + virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty); + virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos); - virtual int selectionTop(); - virtual int selectionHeight(); + // SVGs custom paint text method + void paintCharacters(RenderObject::PaintInfo&, int tx, int ty, const SVGChar&, const UChar* chars, int length, SVGTextPaintInfo&); - virtual int offsetForPosition(int x, bool includePartialGlyphs = true) const; - virtual int positionForOffset(int offset) const; + // SVGs custom paint selection method + void paintSelection(int boxStartOffset, const SVGChar&, const UChar*, int length, GraphicsContext*, RenderStyle*, const Font&); - virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty); - virtual IntRect selectionRect(int absx, int absy, int startPos, int endPos); + // SVGs custom paint decoration method + void paintDecoration(ETextDecoration, GraphicsContext*, int tx, int ty, int width, const SVGChar&, const SVGTextDecorationInfo&); + + SVGRootInlineBox* svgRootInlineBox() const; - // SVGs custom paint text method - void paintCharacters(RenderObject::PaintInfo&, int tx, int ty, const SVGChar&, const UChar* chars, int length, SVGTextPaintInfo&); + // Helper functions shared with SVGRootInlineBox + float calculateGlyphWidth(RenderStyle* style, int offset, int extraCharsAvailable, int& charsConsumed, String& glyphName) const; + float calculateGlyphHeight(RenderStyle*, int offset, int extraCharsAvailable) const; - // SVGs custom paint selection method - void paintSelection(int boxStartOffset, const SVGChar&, const UChar*, int length, GraphicsContext*, RenderStyle*, const Font&); + FloatRect calculateGlyphBoundaries(RenderStyle*, int offset, const SVGChar&) const; + SVGChar* closestCharacterToPosition(int x, int y, int& offset) const; - // SVGs custom paint decoration method - void paintDecoration(ETextDecoration, GraphicsContext*, int tx, int ty, int width, const SVGChar&, const SVGTextDecorationInfo&); - - SVGRootInlineBox* svgRootInlineBox() const; - - // Helper functions shared with SVGRootInlineBox - float calculateGlyphWidth(RenderStyle* style, int offset, int extraCharsAvailable, int& charsConsumed, String& glyphName) const; - float calculateGlyphHeight(RenderStyle*, int offset, int extraCharsAvailable) const; - - FloatRect calculateGlyphBoundaries(RenderStyle*, int offset, const SVGChar&) const; - SVGChar* closestCharacterToPosition(int x, int y, int& offset) const; - - private: - friend class RenderSVGInlineText; - bool svgCharacterHitsPosition(int x, int y, int& offset) const; - bool chunkSelectionStartEnd(const UChar* chunk, int chunkLength, int& selectionStart, int& selectionEnd); - - int m_height; - }; + void buildLayoutInformation(SVGCharacterLayoutInfo&, SVGLastGlyphInfo&); + +private: + friend class RenderSVGInlineText; + bool svgCharacterHitsPosition(int x, int y, int& offset) const; + bool chunkSelectionStartEnd(const UChar* chunk, int chunkLength, int& selectionStart, int& selectionEnd); + + int m_height; +}; } // namespace WebCore |