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

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

Issue 1548913002: Store a <scale, bias> tuple for textLength scale adjustment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop []. Created 4 years, 11 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
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/Allocator.h"
24 #include "wtf/Vector.h" 24 #include "wtf/Vector.h"
25 25
26 namespace blink { 26 namespace blink {
27 27
28 class AffineTransform;
29 class SVGInlineTextBox; 28 class SVGInlineTextBox;
30 struct SVGTextFragment; 29 struct SVGTextFragment;
31 30
32 // SVGTextChunkBuilder performs the third layout phase for SVG text. 31 // SVGTextChunkBuilder performs the third layout phase for SVG text.
33 // 32 //
34 // Phase one built the layout information from the SVG DOM stored in the LayoutS VGInlineText objects (SVGTextLayoutAttributes). 33 // Phase one built the layout information from the SVG DOM stored in the LayoutS VGInlineText objects (SVGTextLayoutAttributes).
35 // Phase two performed the actual per-character layout, computing the final posi tions for each character, stored in the SVGInlineTextBox objects (SVGTextFragmen t). 34 // Phase two performed the actual per-character layout, computing the final posi tions for each character, stored in the SVGInlineTextBox objects (SVGTextFragmen t).
36 // Phase three performs all modifications that have to be applied to each indivi dual text chunk (text-anchor & textLength). 35 // Phase three performs all modifications that have to be applied to each indivi dual text chunk (text-anchor & textLength).
37 36
38 class SVGTextChunkBuilder { 37 class SVGTextChunkBuilder {
39 STACK_ALLOCATED(); 38 STACK_ALLOCATED();
40 WTF_MAKE_NONCOPYABLE(SVGTextChunkBuilder); 39 WTF_MAKE_NONCOPYABLE(SVGTextChunkBuilder);
41 public: 40 public:
42 SVGTextChunkBuilder(); 41 SVGTextChunkBuilder();
43 42
44 void processTextChunks(const Vector<SVGInlineTextBox*>&); 43 void processTextChunks(const Vector<SVGInlineTextBox*>&);
45 44
46 protected: 45 protected:
47 typedef Vector<SVGInlineTextBox*>::const_iterator BoxListConstIterator; 46 typedef Vector<SVGInlineTextBox*>::const_iterator BoxListConstIterator;
48 47
49 virtual void handleTextChunk(BoxListConstIterator boxStart, BoxListConstIter ator boxEnd); 48 virtual void handleTextChunk(BoxListConstIterator boxStart, BoxListConstIter ator boxEnd);
50 49
51 private: 50 private:
52 void processTextLengthSpacingCorrection(bool isVerticalText, float textLengt hShift, Vector<SVGTextFragment>&, unsigned& atCharacter); 51 void processTextLengthSpacingCorrection(bool isVerticalText, float textLengt hShift, Vector<SVGTextFragment>&, unsigned& atCharacter);
53 void applyTextLengthScaleAdjustment(const AffineTransform&, Vector<SVGTextFr agment>&); 52 void applyTextLengthScaleAdjustment(float textLengthScale, float textLengthB ias, Vector<SVGTextFragment>&);
54 void processTextAnchorCorrection(bool isVerticalText, float textAnchorShift, Vector<SVGTextFragment>&); 53 void processTextAnchorCorrection(bool isVerticalText, float textAnchorShift, Vector<SVGTextFragment>&);
55 }; 54 };
56 55
57 class SVGTextPathChunkBuilder final : public SVGTextChunkBuilder { 56 class SVGTextPathChunkBuilder final : public SVGTextChunkBuilder {
58 STACK_ALLOCATED(); 57 STACK_ALLOCATED();
59 WTF_MAKE_NONCOPYABLE(SVGTextPathChunkBuilder); 58 WTF_MAKE_NONCOPYABLE(SVGTextPathChunkBuilder);
60 public: 59 public:
61 SVGTextPathChunkBuilder(); 60 SVGTextPathChunkBuilder();
62 61
63 float totalLength() const { return m_totalLength; } 62 float totalLength() const { return m_totalLength; }
64 unsigned totalCharacters() const { return m_totalCharacters; } 63 unsigned totalCharacters() const { return m_totalCharacters; }
65 float totalTextAnchorShift() const { return m_totalTextAnchorShift; } 64 float totalTextAnchorShift() const { return m_totalTextAnchorShift; }
66 65
67 private: 66 private:
68 void handleTextChunk(BoxListConstIterator boxStart, BoxListConstIterator box End) override; 67 void handleTextChunk(BoxListConstIterator boxStart, BoxListConstIterator box End) override;
69 68
70 float m_totalLength; 69 float m_totalLength;
71 unsigned m_totalCharacters; 70 unsigned m_totalCharacters;
72 float m_totalTextAnchorShift; 71 float m_totalTextAnchorShift;
73 }; 72 };
74 73
75 } // namespace blink 74 } // namespace blink
76 75
77 #endif 76 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | third_party/WebKit/Source/core/layout/svg/SVGTextChunkBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698