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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 SVGInlineTextBox* textBox = toSVGInlineTextBox(box); | 177 SVGInlineTextBox* textBox = toSVGInlineTextBox(box); |
178 Vector<SVGTextFragment>& fragments = textBox->textFragments(); | 178 Vector<SVGTextFragment>& fragments = textBox->textFragments(); |
179 | 179 |
180 unsigned textFragmentsSize = fragments.size(); | 180 unsigned textFragmentsSize = fragments.size(); |
181 for (unsigned i = 0; i < textFragmentsSize; ++i) { | 181 for (unsigned i = 0; i < textFragmentsSize; ++i) { |
182 const SVGTextFragment& fragment = fragments.at(i); | 182 const SVGTextFragment& fragment = fragments.at(i); |
183 FloatRect fragmentRect(fragment.x, fragment.y - baseline, fragment.w idth, fragment.height); | 183 FloatRect fragmentRect(fragment.x, fragment.y - baseline, fragment.w idth, fragment.height); |
184 fragment.buildFragmentTransform(fragmentTransform); | 184 fragment.buildFragmentTransform(fragmentTransform); |
185 fragmentRect = fragmentTransform.mapRect(fragmentRect); | 185 fragmentRect = fragmentTransform.mapRect(fragmentRect); |
186 | 186 |
187 float distance = powf(fragmentRect.x() - absolutePoint.x(), 2) + | 187 float distance = powf(fragmentRect.x() + fragmentRect.width() / 2 - absolutePoint.x(), 2) + |
fs
2015/04/21 10:46:20
Looks like this could now be:
float distance = (f
| |
188 powf(fragmentRect.y() + fragmentRect.height() / 2 - absolutePoin t.y(), 2); | 188 powf(fragmentRect.y() + fragmentRect.height() / 2 - absolutePoin t.y(), 2); |
189 | 189 |
190 if (distance < closestDistance) { | 190 if (distance < closestDistance) { |
191 closestDistance = distance; | 191 closestDistance = distance; |
192 closestDistanceBox = textBox; | 192 closestDistanceBox = textBox; |
193 closestDistanceFragment = &fragment; | 193 closestDistanceFragment = &fragment; |
194 closestDistancePosition = fragmentRect.x(); | 194 closestDistancePosition = fragmentRect.x(); |
195 } | 195 } |
196 } | 196 } |
197 } | 197 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 | 244 |
245 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const | 245 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const |
246 { | 246 { |
247 RefPtr<StringImpl> result = LayoutText::originalText(); | 247 RefPtr<StringImpl> result = LayoutText::originalText(); |
248 if (!result) | 248 if (!result) |
249 return nullptr; | 249 return nullptr; |
250 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P RE); | 250 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P RE); |
251 } | 251 } |
252 | 252 |
253 } | 253 } |
OLD | NEW |