| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
| 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 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 | 24 |
| 25 #include "core/layout/line/InlineTextBox.h" | 25 #include "core/layout/line/InlineTextBox.h" |
| 26 #include "core/layout/svg/SVGTextLayoutEngine.h" | 26 #include "core/layout/svg/SVGTextLayoutEngine.h" |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 class SVGInlineTextBox final : public InlineTextBox { | 30 class SVGInlineTextBox final : public InlineTextBox { |
| 31 public: | 31 public: |
| 32 SVGInlineTextBox(LayoutObject&, int start, unsigned short length); | 32 SVGInlineTextBox(LayoutObject&, int start, unsigned short length); |
| 33 | 33 |
| 34 virtual bool isSVGInlineTextBox() const override { return true; } | 34 bool isSVGInlineTextBox() const override { return true; } |
| 35 | 35 |
| 36 virtual LayoutUnit virtualLogicalHeight() const override { return m_logicalH
eight; } | 36 LayoutUnit virtualLogicalHeight() const override { return m_logicalHeight; } |
| 37 void setLogicalHeight(LayoutUnit height) { m_logicalHeight = height; } | 37 void setLogicalHeight(LayoutUnit height) { m_logicalHeight = height; } |
| 38 | 38 |
| 39 virtual int offsetForPosition(LayoutUnit x, bool includePartialGlyphs = true
) const override; | 39 int offsetForPosition(LayoutUnit x, bool includePartialGlyphs = true) const
override; |
| 40 virtual LayoutUnit positionForOffset(int offset) const override; | 40 LayoutUnit positionForOffset(int offset) const override; |
| 41 | 41 |
| 42 virtual void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop,
LayoutUnit lineBottom) override; | 42 void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutU
nit lineBottom) override; |
| 43 virtual LayoutRect localSelectionRect(int startPosition, int endPosition) ov
erride; | 43 LayoutRect localSelectionRect(int startPosition, int endPosition) override; |
| 44 | 44 |
| 45 bool mapStartEndPositionsIntoFragmentCoordinates(const SVGTextFragment&, int
& startPosition, int& endPosition) const; | 45 bool mapStartEndPositionsIntoFragmentCoordinates(const SVGTextFragment&, int
& startPosition, int& endPosition) const; |
| 46 | 46 |
| 47 virtual LayoutRect calculateBoundaries() const override; | 47 LayoutRect calculateBoundaries() const override; |
| 48 | 48 |
| 49 void clearTextFragments() { m_textFragments.clear(); } | 49 void clearTextFragments() { m_textFragments.clear(); } |
| 50 Vector<SVGTextFragment>& textFragments() { return m_textFragments; } | 50 Vector<SVGTextFragment>& textFragments() { return m_textFragments; } |
| 51 const Vector<SVGTextFragment>& textFragments() const { return m_textFragment
s; } | 51 const Vector<SVGTextFragment>& textFragments() const { return m_textFragment
s; } |
| 52 | 52 |
| 53 virtual void dirtyLineBoxes() override; | 53 void dirtyLineBoxes() override; |
| 54 | 54 |
| 55 bool startsNewTextChunk() const { return m_startsNewTextChunk; } | 55 bool startsNewTextChunk() const { return m_startsNewTextChunk; } |
| 56 void setStartsNewTextChunk(bool newTextChunk) { m_startsNewTextChunk = newTe
xtChunk; } | 56 void setStartsNewTextChunk(bool newTextChunk) { m_startsNewTextChunk = newTe
xtChunk; } |
| 57 | 57 |
| 58 int offsetForPositionInFragment(const SVGTextFragment&, LayoutUnit position,
bool includePartialGlyphs) const; | 58 int offsetForPositionInFragment(const SVGTextFragment&, LayoutUnit position,
bool includePartialGlyphs) const; |
| 59 FloatRect selectionRectForTextFragment(const SVGTextFragment&, int fragmentS
tartPosition, int fragmentEndPosition, const ComputedStyle&); | 59 FloatRect selectionRectForTextFragment(const SVGTextFragment&, int fragmentS
tartPosition, int fragmentEndPosition, const ComputedStyle&); |
| 60 TextRun constructTextRun(const ComputedStyle&, const SVGTextFragment&) const
; | 60 TextRun constructTextRun(const ComputedStyle&, const SVGTextFragment&) const
; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 virtual void paintDocumentMarker(GraphicsContext*, const LayoutPoint&, Docum
entMarker*, const ComputedStyle&, const Font&, bool) override final; | 63 void paintDocumentMarker(GraphicsContext*, const LayoutPoint&, DocumentMarke
r*, const ComputedStyle&, const Font&, bool) final; |
| 64 virtual void paintTextMatchMarker(GraphicsContext*, const LayoutPoint&, Docu
mentMarker*, const ComputedStyle&, const Font&) override final; | 64 void paintTextMatchMarker(GraphicsContext*, const LayoutPoint&, DocumentMark
er*, const ComputedStyle&, const Font&) final; |
| 65 | 65 |
| 66 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInCo
ntainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit li
neBottom) override; | 66 bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInContainer,
const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom
) override; |
| 67 | 67 |
| 68 LayoutUnit m_logicalHeight; | 68 LayoutUnit m_logicalHeight; |
| 69 bool m_startsNewTextChunk : 1; | 69 bool m_startsNewTextChunk : 1; |
| 70 Vector<SVGTextFragment> m_textFragments; | 70 Vector<SVGTextFragment> m_textFragments; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 DEFINE_INLINE_BOX_TYPE_CASTS(SVGInlineTextBox); | 73 DEFINE_INLINE_BOX_TYPE_CASTS(SVGInlineTextBox); |
| 74 | 74 |
| 75 } // namespace blink | 75 } // namespace blink |
| 76 | 76 |
| 77 #endif // SVGInlineTextBox_h | 77 #endif // SVGInlineTextBox_h |
| OLD | NEW |