OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
3 * Copyright (C) 2006 Apple Computer Inc. | 3 * Copyright (C) 2006 Apple Computer Inc. |
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
5 * Copyright (C) 2008 Rob Buis <buis@kde.org> | 5 * Copyright (C) 2008 Rob Buis <buis@kde.org> |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 { | 47 { |
48 RefPtr<StringImpl> newString = string->replace('\t', ' '); | 48 RefPtr<StringImpl> newString = string->replace('\t', ' '); |
49 newString = newString->replace('\n', ' '); | 49 newString = newString->replace('\n', ' '); |
50 newString = newString->replace('\r', ' '); | 50 newString = newString->replace('\r', ' '); |
51 return newString.release(); | 51 return newString.release(); |
52 } | 52 } |
53 | 53 |
54 LayoutSVGInlineText::LayoutSVGInlineText(Node* n, PassRefPtr<StringImpl> string) | 54 LayoutSVGInlineText::LayoutSVGInlineText(Node* n, PassRefPtr<StringImpl> string) |
55 : LayoutText(n, normalizeWhitespace(string)) | 55 : LayoutText(n, normalizeWhitespace(string)) |
56 , m_scalingFactor(1) | 56 , m_scalingFactor(1) |
57 , m_layoutAttributes(this) | |
58 { | 57 { |
59 } | 58 } |
60 | 59 |
61 void LayoutSVGInlineText::setTextInternal(PassRefPtr<StringImpl> text) | 60 void LayoutSVGInlineText::setTextInternal(PassRefPtr<StringImpl> text) |
62 { | 61 { |
63 LayoutText::setTextInternal(text); | 62 LayoutText::setTextInternal(text); |
64 if (LayoutSVGText* textLayoutObject = LayoutSVGText::locateLayoutSVGTextAnce
stor(this)) | 63 if (LayoutSVGText* textLayoutObject = LayoutSVGText::locateLayoutSVGTextAnce
stor(this)) |
65 textLayoutObject->subtreeTextDidChange(); | 64 textLayoutObject->subtreeTextDidChange(); |
66 } | 65 } |
67 | 66 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 129 |
131 bool LayoutSVGInlineText::characterStartsNewTextChunk(int position) const | 130 bool LayoutSVGInlineText::characterStartsNewTextChunk(int position) const |
132 { | 131 { |
133 ASSERT(position >= 0); | 132 ASSERT(position >= 0); |
134 ASSERT(position < static_cast<int>(textLength())); | 133 ASSERT(position < static_cast<int>(textLength())); |
135 | 134 |
136 // Each <textPath> element starts a new text chunk, regardless of any x/y va
lues. | 135 // Each <textPath> element starts a new text chunk, regardless of any x/y va
lues. |
137 if (!position && parent()->isSVGTextPath() && !previousSibling()) | 136 if (!position && parent()->isSVGTextPath() && !previousSibling()) |
138 return true; | 137 return true; |
139 | 138 |
140 const SVGCharacterDataMap::const_iterator it = m_layoutAttributes.characterD
ataMap().find(static_cast<unsigned>(position + 1)); | 139 const SVGCharacterDataMap::const_iterator it = m_characterDataMap.find(stati
c_cast<unsigned>(position + 1)); |
141 if (it == m_layoutAttributes.characterDataMap().end()) | 140 if (it == m_characterDataMap.end()) |
142 return false; | 141 return false; |
143 | 142 |
144 return it->value.hasX() || it->value.hasY(); | 143 return it->value.hasX() || it->value.hasY(); |
145 } | 144 } |
146 | 145 |
147 PositionWithAffinity LayoutSVGInlineText::positionForPoint(const LayoutPoint& po
int) | 146 PositionWithAffinity LayoutSVGInlineText::positionForPoint(const LayoutPoint& po
int) |
148 { | 147 { |
149 if (!hasTextBoxes() || !textLength()) | 148 if (!hasTextBoxes() || !textLength()) |
150 return createPositionWithAffinity(0); | 149 return createPositionWithAffinity(0); |
151 | 150 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 378 |
380 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const | 379 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const |
381 { | 380 { |
382 RefPtr<StringImpl> result = LayoutText::originalText(); | 381 RefPtr<StringImpl> result = LayoutText::originalText(); |
383 if (!result) | 382 if (!result) |
384 return nullptr; | 383 return nullptr; |
385 return normalizeWhitespace(result); | 384 return normalizeWhitespace(result); |
386 } | 385 } |
387 | 386 |
388 } // namespace blink | 387 } // namespace blink |
OLD | NEW |