| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010-2012. 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 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 break; | 208 break; |
| 209 | 209 |
| 210 lastPositionOffset = positionOffset; | 210 lastPositionOffset = positionOffset; |
| 211 positionOffset += metrics.length(); | 211 positionOffset += metrics.length(); |
| 212 } | 212 } |
| 213 | 213 |
| 214 if (!alterStartPosition && !alterEndPosition) | 214 if (!alterStartPosition && !alterEndPosition) |
| 215 return; | 215 return; |
| 216 | 216 |
| 217 if (lastPositionOffset != -1 && lastPositionOffset - positionOffset > 1) { | 217 if (lastPositionOffset != -1 && lastPositionOffset - positionOffset > 1) { |
| 218 if (alterStartPosition && startPosition > lastPositionOffset && startPos
ition < static_cast<int>(positionOffset)) { | 218 if (alterStartPosition && startPosition > lastPositionOffset && startPos
ition < static_cast<int>(positionOffset)) |
| 219 startPosition = lastPositionOffset; | 219 startPosition = lastPositionOffset; |
| 220 alterStartPosition = false; | |
| 221 } | |
| 222 | 220 |
| 223 if (alterEndPosition && endPosition > lastPositionOffset && endPosition
< static_cast<int>(positionOffset)) { | 221 if (alterEndPosition && endPosition > lastPositionOffset && endPosition
< static_cast<int>(positionOffset)) |
| 224 endPosition = positionOffset; | 222 endPosition = positionOffset; |
| 225 alterEndPosition = false; | |
| 226 } | |
| 227 } | 223 } |
| 228 } | 224 } |
| 229 | 225 |
| 230 // numberOfCharacters() implementation | 226 // numberOfCharacters() implementation |
| 231 bool SVGTextQuery::numberOfCharactersCallback(Data*, const SVGTextFragment&) con
st | 227 bool SVGTextQuery::numberOfCharactersCallback(Data*, const SVGTextFragment&) con
st |
| 232 { | 228 { |
| 233 // no-op | 229 // no-op |
| 234 return false; | 230 return false; |
| 235 } | 231 } |
| 236 | 232 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 return -1; | 542 return -1; |
| 547 | 543 |
| 548 CharacterNumberAtPositionData data(position); | 544 CharacterNumberAtPositionData data(position); |
| 549 if (!executeQuery(&data, &SVGTextQuery::characterNumberAtPositionCallback)) | 545 if (!executeQuery(&data, &SVGTextQuery::characterNumberAtPositionCallback)) |
| 550 return -1; | 546 return -1; |
| 551 | 547 |
| 552 return data.processedCharacters; | 548 return data.processedCharacters; |
| 553 } | 549 } |
| 554 | 550 |
| 555 } | 551 } |
| OLD | NEW |