Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: Source/core/layout/svg/line/SVGInlineTextBox.h

Issue 1043643002: Switch line layout to LayoutUnit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More TestExpectations tweaks Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #ifndef SVGInlineTextBox_h 22 #ifndef SVGInlineTextBox_h
23 #define SVGInlineTextBox_h 23 #define SVGInlineTextBox_h
24 24
25 #include "core/layout/line/FloatToLayoutUnit.h"
26 #include "core/layout/line/InlineTextBox.h" 25 #include "core/layout/line/InlineTextBox.h"
27 #include "core/layout/svg/SVGTextLayoutEngine.h" 26 #include "core/layout/svg/SVGTextLayoutEngine.h"
28 27
29 namespace blink { 28 namespace blink {
30 29
31 class SVGInlineTextBox final : public InlineTextBox { 30 class SVGInlineTextBox final : public InlineTextBox {
32 public: 31 public:
33 SVGInlineTextBox(LayoutObject&, int start, unsigned short length); 32 SVGInlineTextBox(LayoutObject&, int start, unsigned short length);
34 33
35 virtual bool isSVGInlineTextBox() const override { return true; } 34 virtual bool isSVGInlineTextBox() const override { return true; }
36 35
37 virtual FloatWillBeLayoutUnit virtualLogicalHeight() const override { return m_logicalHeight; } 36 virtual LayoutUnit virtualLogicalHeight() const override { return m_logicalH eight; }
38 void setLogicalHeight(FloatWillBeLayoutUnit height) { m_logicalHeight = heig ht; } 37 void setLogicalHeight(LayoutUnit height) { m_logicalHeight = height; }
39 38
40 virtual int offsetForPosition(FloatWillBeLayoutUnit x, bool includePartialGl yphs = true) const override; 39 virtual int offsetForPosition(LayoutUnit x, bool includePartialGlyphs = true ) const override;
41 virtual FloatWillBeLayoutUnit positionForOffset(int offset) const override; 40 virtual LayoutUnit positionForOffset(int offset) const override;
42 41
43 virtual void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override; 42 virtual void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override;
44 virtual LayoutRect localSelectionRect(int startPosition, int endPosition) ov erride; 43 virtual LayoutRect localSelectionRect(int startPosition, int endPosition) ov erride;
45 44
46 bool mapStartEndPositionsIntoFragmentCoordinates(const SVGTextFragment&, int & startPosition, int& endPosition) const; 45 bool mapStartEndPositionsIntoFragmentCoordinates(const SVGTextFragment&, int & startPosition, int& endPosition) const;
47 46
48 virtual FloatRectWillBeLayoutRect calculateBoundaries() const override; 47 virtual LayoutRect calculateBoundaries() const override;
49 48
50 void clearTextFragments() { m_textFragments.clear(); } 49 void clearTextFragments() { m_textFragments.clear(); }
51 Vector<SVGTextFragment>& textFragments() { return m_textFragments; } 50 Vector<SVGTextFragment>& textFragments() { return m_textFragments; }
52 const Vector<SVGTextFragment>& textFragments() const { return m_textFragment s; } 51 const Vector<SVGTextFragment>& textFragments() const { return m_textFragment s; }
53 52
54 virtual void dirtyLineBoxes() override; 53 virtual void dirtyLineBoxes() override;
55 54
56 bool startsNewTextChunk() const { return m_startsNewTextChunk; } 55 bool startsNewTextChunk() const { return m_startsNewTextChunk; }
57 void setStartsNewTextChunk(bool newTextChunk) { m_startsNewTextChunk = newTe xtChunk; } 56 void setStartsNewTextChunk(bool newTextChunk) { m_startsNewTextChunk = newTe xtChunk; }
58 57
59 int offsetForPositionInFragment(const SVGTextFragment&, FloatWillBeLayoutUni t position, bool includePartialGlyphs) const; 58 int offsetForPositionInFragment(const SVGTextFragment&, LayoutUnit position, bool includePartialGlyphs) const;
60 FloatRect selectionRectForTextFragment(const SVGTextFragment&, int fragmentS tartPosition, int fragmentEndPosition, const ComputedStyle&); 59 FloatRect selectionRectForTextFragment(const SVGTextFragment&, int fragmentS tartPosition, int fragmentEndPosition, const ComputedStyle&);
61 TextRun constructTextRun(const ComputedStyle&, const SVGTextFragment&) const ; 60 TextRun constructTextRun(const ComputedStyle&, const SVGTextFragment&) const ;
62 61
63 private: 62 private:
64 virtual void paintDocumentMarker(GraphicsContext*, const FloatPointWillBeLay outPoint&, DocumentMarker*, const ComputedStyle&, const Font&, bool) override fi nal; 63 virtual void paintDocumentMarker(GraphicsContext*, const LayoutPoint&, Docum entMarker*, const ComputedStyle&, const Font&, bool) override final;
65 virtual void paintTextMatchMarker(GraphicsContext*, const FloatPointWillBeLa youtPoint&, DocumentMarker*, const ComputedStyle&, const Font&) override final; 64 virtual void paintTextMatchMarker(GraphicsContext*, const LayoutPoint&, Docu mentMarker*, const ComputedStyle&, const Font&) override final;
66 65
67 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInCo ntainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit li neBottom) override; 66 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInCo ntainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit li neBottom) override;
68 67
69 FloatWillBeLayoutUnit m_logicalHeight; 68 LayoutUnit m_logicalHeight;
70 bool m_startsNewTextChunk : 1; 69 bool m_startsNewTextChunk : 1;
71 Vector<SVGTextFragment> m_textFragments; 70 Vector<SVGTextFragment> m_textFragments;
72 }; 71 };
73 72
74 DEFINE_INLINE_BOX_TYPE_CASTS(SVGInlineTextBox); 73 DEFINE_INLINE_BOX_TYPE_CASTS(SVGInlineTextBox);
75 74
76 } // namespace blink 75 } // namespace blink
77 76
78 #endif // SVGInlineTextBox_h 77 #endif // SVGInlineTextBox_h
OLDNEW
« no previous file with comments | « Source/core/layout/svg/line/SVGInlineFlowBox.cpp ('k') | Source/core/layout/svg/line/SVGInlineTextBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698