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

Side by Side Diff: Source/core/layout/svg/SVGTextChunkBuilder.h

Issue 1318713003: Make classes and structures in core/layout fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « Source/core/layout/svg/SVGSubpathData.h ('k') | Source/core/layout/svg/SVGTextFragment.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #ifndef SVGTextChunkBuilder_h 20 #ifndef SVGTextChunkBuilder_h
21 #define SVGTextChunkBuilder_h 21 #define SVGTextChunkBuilder_h
22 22
23 #include "wtf/Allocator.h"
23 #include "wtf/Vector.h" 24 #include "wtf/Vector.h"
24 25
25 namespace blink { 26 namespace blink {
26 27
27 class AffineTransform; 28 class AffineTransform;
28 class SVGInlineTextBox; 29 class SVGInlineTextBox;
29 struct SVGTextFragment; 30 struct SVGTextFragment;
30 31
31 // SVGTextChunkBuilder performs the third layout phase for SVG text. 32 // SVGTextChunkBuilder performs the third layout phase for SVG text.
32 // 33 //
33 // Phase one built the layout information from the SVG DOM stored in the LayoutS VGInlineText objects (SVGTextLayoutAttributes). 34 // Phase one built the layout information from the SVG DOM stored in the LayoutS VGInlineText objects (SVGTextLayoutAttributes).
34 // Phase two performed the actual per-character layout, computing the final posi tions for each character, stored in the SVGInlineTextBox objects (SVGTextFragmen t). 35 // Phase two performed the actual per-character layout, computing the final posi tions for each character, stored in the SVGInlineTextBox objects (SVGTextFragmen t).
35 // Phase three performs all modifications that have to be applied to each indivi dual text chunk (text-anchor & textLength). 36 // Phase three performs all modifications that have to be applied to each indivi dual text chunk (text-anchor & textLength).
36 37
37 class SVGTextChunkBuilder { 38 class SVGTextChunkBuilder {
39 STACK_ALLOCATED();
38 WTF_MAKE_NONCOPYABLE(SVGTextChunkBuilder); 40 WTF_MAKE_NONCOPYABLE(SVGTextChunkBuilder);
39 public: 41 public:
40 SVGTextChunkBuilder(); 42 SVGTextChunkBuilder();
41 43
42 void processTextChunks(const Vector<SVGInlineTextBox*>&); 44 void processTextChunks(const Vector<SVGInlineTextBox*>&);
43 45
44 protected: 46 protected:
45 typedef Vector<SVGInlineTextBox*>::const_iterator BoxListConstIterator; 47 typedef Vector<SVGInlineTextBox*>::const_iterator BoxListConstIterator;
46 48
47 virtual void handleTextChunk(BoxListConstIterator boxStart, BoxListConstIter ator boxEnd); 49 virtual void handleTextChunk(BoxListConstIterator boxStart, BoxListConstIter ator boxEnd);
48 50
49 private: 51 private:
50 void processTextLengthSpacingCorrection(bool isVerticalText, float textLengt hShift, Vector<SVGTextFragment>&, unsigned& atCharacter); 52 void processTextLengthSpacingCorrection(bool isVerticalText, float textLengt hShift, Vector<SVGTextFragment>&, unsigned& atCharacter);
51 void applyTextLengthScaleAdjustment(const AffineTransform&, Vector<SVGTextFr agment>&); 53 void applyTextLengthScaleAdjustment(const AffineTransform&, Vector<SVGTextFr agment>&);
52 void processTextAnchorCorrection(bool isVerticalText, float textAnchorShift, Vector<SVGTextFragment>&); 54 void processTextAnchorCorrection(bool isVerticalText, float textAnchorShift, Vector<SVGTextFragment>&);
53 }; 55 };
54 56
55 class SVGTextPathChunkBuilder final : public SVGTextChunkBuilder { 57 class SVGTextPathChunkBuilder final : public SVGTextChunkBuilder {
58 STACK_ALLOCATED();
56 WTF_MAKE_NONCOPYABLE(SVGTextPathChunkBuilder); 59 WTF_MAKE_NONCOPYABLE(SVGTextPathChunkBuilder);
57 public: 60 public:
58 SVGTextPathChunkBuilder(); 61 SVGTextPathChunkBuilder();
59 62
60 float totalLength() const { return m_totalLength; } 63 float totalLength() const { return m_totalLength; }
61 unsigned totalCharacters() const { return m_totalCharacters; } 64 unsigned totalCharacters() const { return m_totalCharacters; }
62 float totalTextAnchorShift() const { return m_totalTextAnchorShift; } 65 float totalTextAnchorShift() const { return m_totalTextAnchorShift; }
63 66
64 private: 67 private:
65 void handleTextChunk(BoxListConstIterator boxStart, BoxListConstIterator box End) override; 68 void handleTextChunk(BoxListConstIterator boxStart, BoxListConstIterator box End) override;
66 69
67 float m_totalLength; 70 float m_totalLength;
68 unsigned m_totalCharacters; 71 unsigned m_totalCharacters;
69 float m_totalTextAnchorShift; 72 float m_totalTextAnchorShift;
70 }; 73 };
71 74
72 } // namespace blink 75 } // namespace blink
73 76
74 #endif 77 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/svg/SVGSubpathData.h ('k') | Source/core/layout/svg/SVGTextFragment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698