| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 float closestDistancePosition = 0; | 176 float closestDistancePosition = 0; |
| 177 const SVGTextFragment* closestDistanceFragment = nullptr; | 177 const SVGTextFragment* closestDistanceFragment = nullptr; |
| 178 SVGInlineTextBox* closestDistanceBox = nullptr; | 178 SVGInlineTextBox* closestDistanceBox = nullptr; |
| 179 | 179 |
| 180 AffineTransform fragmentTransform; | 180 AffineTransform fragmentTransform; |
| 181 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { | 181 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { |
| 182 if (!box->isSVGInlineTextBox()) | 182 if (!box->isSVGInlineTextBox()) |
| 183 continue; | 183 continue; |
| 184 | 184 |
| 185 SVGInlineTextBox* textBox = toSVGInlineTextBox(box); | 185 SVGInlineTextBox* textBox = toSVGInlineTextBox(box); |
| 186 Vector<SVGTextFragment>& fragments = textBox->textFragments(); | 186 for (const SVGTextFragment& fragment : textBox->textFragments()) { |
| 187 | 187 FloatRect fragmentRect = fragment.boundingBox(baseline); |
| 188 unsigned textFragmentsSize = fragments.size(); | |
| 189 for (unsigned i = 0; i < textFragmentsSize; ++i) { | |
| 190 const SVGTextFragment& fragment = fragments.at(i); | |
| 191 FloatRect fragmentRect(fragment.x, fragment.y - baseline, fragment.w
idth, fragment.height); | |
| 192 fragment.buildFragmentTransform(fragmentTransform); | |
| 193 if (!fragmentTransform.isIdentity()) | |
| 194 fragmentRect = fragmentTransform.mapRect(fragmentRect); | |
| 195 | 188 |
| 196 float distance = 0; | 189 float distance = 0; |
| 197 if (!fragmentRect.contains(absolutePoint)) | 190 if (!fragmentRect.contains(absolutePoint)) |
| 198 distance = squaredDistanceToClosestPoint(fragmentRect, absoluteP
oint); | 191 distance = squaredDistanceToClosestPoint(fragmentRect, absoluteP
oint); |
| 199 | 192 |
| 200 if (distance <= closestDistance) { | 193 if (distance <= closestDistance) { |
| 201 closestDistance = distance; | 194 closestDistance = distance; |
| 202 closestDistanceBox = textBox; | 195 closestDistanceBox = textBox; |
| 203 closestDistanceFragment = &fragment; | 196 closestDistanceFragment = &fragment; |
| 204 closestDistancePosition = fragmentRect.x(); | 197 closestDistancePosition = fragmentRect.x(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 248 |
| 256 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const | 249 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const |
| 257 { | 250 { |
| 258 RefPtr<StringImpl> result = LayoutText::originalText(); | 251 RefPtr<StringImpl> result = LayoutText::originalText(); |
| 259 if (!result) | 252 if (!result) |
| 260 return nullptr; | 253 return nullptr; |
| 261 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P
RE); | 254 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P
RE); |
| 262 } | 255 } |
| 263 | 256 |
| 264 } | 257 } |
| OLD | NEW |