| OLD | NEW |
| 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 SVGTextFragment_h | 20 #ifndef SVGTextFragment_h |
| 21 #define SVGTextFragment_h | 21 #define SVGTextFragment_h |
| 22 | 22 |
| 23 #include "core/layout/line/GlyphOverflow.h" | 23 #include "core/layout/line/GlyphOverflow.h" |
| 24 #include "platform/transforms/AffineTransform.h" | 24 #include "platform/transforms/AffineTransform.h" |
| 25 #include "wtf/Allocator.h" | 25 #include "wtf/Allocator.h" |
| 26 | 26 |
| 27 namespace blink { | 27 namespace blink { |
| 28 | 28 |
| 29 // A SVGTextFragment describes a text fragment of a LayoutSVGInlineText which ca
n be laid out at once. | 29 // A SVGTextFragment describes a text fragment of a LayoutSVGInlineText which |
| 30 // can be laid out at once. |
| 30 struct SVGTextFragment { | 31 struct SVGTextFragment { |
| 31 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 32 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 32 SVGTextFragment() | 33 SVGTextFragment() |
| 33 : characterOffset(0), | 34 : characterOffset(0), |
| 34 metricsListOffset(0), | 35 metricsListOffset(0), |
| 35 length(0), | 36 length(0), |
| 36 isTextOnPath(false), | 37 isTextOnPath(false), |
| 37 isVertical(false), | 38 isVertical(false), |
| 38 x(0), | 39 x(0), |
| 39 y(0), | 40 y(0), |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 transformAroundOrigin(result); | 79 transformAroundOrigin(result); |
| 79 return result; | 80 return result; |
| 80 } | 81 } |
| 81 return buildNormalFragmentTransform(); | 82 return buildNormalFragmentTransform(); |
| 82 } | 83 } |
| 83 | 84 |
| 84 bool isTransformed() const { | 85 bool isTransformed() const { |
| 85 return affectedByTextLength() || !transform.isIdentity(); | 86 return affectedByTextLength() || !transform.isIdentity(); |
| 86 } | 87 } |
| 87 | 88 |
| 88 // The first laid out character starts at LayoutSVGInlineText::characters() +
characterOffset. | 89 // The first laid out character starts at LayoutSVGInlineText::characters() + |
| 90 // characterOffset. |
| 89 unsigned characterOffset; | 91 unsigned characterOffset; |
| 90 unsigned metricsListOffset; | 92 unsigned metricsListOffset; |
| 91 unsigned length : 30; | 93 unsigned length : 30; |
| 92 unsigned isTextOnPath : 1; | 94 unsigned isTextOnPath : 1; |
| 93 unsigned isVertical : 1; | 95 unsigned isVertical : 1; |
| 94 | 96 |
| 95 float x; | 97 float x; |
| 96 float y; | 98 float y; |
| 97 float width; | 99 float width; |
| 98 float height; | 100 float height; |
| 99 | 101 |
| 100 GlyphOverflow glyphOverflow; | 102 GlyphOverflow glyphOverflow; |
| 101 | 103 |
| 102 // Includes rotation/glyph-orientation-(horizontal|vertical) transforms, as we
ll as orientation related shifts | 104 // Includes rotation/glyph-orientation-(horizontal|vertical) transforms, as |
| 105 // well as orientation related shifts |
| 103 // (see SVGTextLayoutEngine, which builds this transformation). | 106 // (see SVGTextLayoutEngine, which builds this transformation). |
| 104 AffineTransform transform; | 107 AffineTransform transform; |
| 105 | 108 |
| 106 // Contains lengthAdjust related transformations, which are not allowd to infl
uence the SVGTextQuery code. | 109 // Contains lengthAdjust related transformations, which are not allowd to |
| 110 // influence the SVGTextQuery code. |
| 107 float lengthAdjustScale; | 111 float lengthAdjustScale; |
| 108 float lengthAdjustBias; | 112 float lengthAdjustBias; |
| 109 | 113 |
| 110 private: | 114 private: |
| 111 AffineTransform buildNormalFragmentTransform() const { | 115 AffineTransform buildNormalFragmentTransform() const { |
| 112 if (isTextOnPath) | 116 if (isTextOnPath) |
| 113 return buildTransformForTextOnPath(); | 117 return buildTransformForTextOnPath(); |
| 114 return buildTransformForTextOnLine(); | 118 return buildTransformForTextOnLine(); |
| 115 } | 119 } |
| 116 | 120 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 AffineTransform result = transform; | 164 AffineTransform result = transform; |
| 161 transformAroundOrigin(result); | 165 transformAroundOrigin(result); |
| 162 result.preMultiply(lengthAdjustTransform()); | 166 result.preMultiply(lengthAdjustTransform()); |
| 163 return result; | 167 return result; |
| 164 } | 168 } |
| 165 }; | 169 }; |
| 166 | 170 |
| 167 } // namespace blink | 171 } // namespace blink |
| 168 | 172 |
| 169 #endif | 173 #endif |
| OLD | NEW |