| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. | 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); | 445 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); |
| 446 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); | 446 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); |
| 447 } | 447 } |
| 448 | 448 |
| 449 int ShapeResult::offsetForPosition(Vector<RefPtr<ShapeResult>>& results, | 449 int ShapeResult::offsetForPosition(Vector<RefPtr<ShapeResult>>& results, |
| 450 const TextRun& run, float targetX) | 450 const TextRun& run, float targetX) |
| 451 { | 451 { |
| 452 unsigned totalOffset; | 452 unsigned totalOffset; |
| 453 if (run.rtl()) { | 453 if (run.rtl()) { |
| 454 totalOffset = run.length(); | 454 totalOffset = run.length(); |
| 455 for (auto& wordResult : results) { | 455 for (unsigned i = results.size(); i; --i) { |
| 456 const RefPtr<ShapeResult>& wordResult = results[i - 1]; |
| 456 if (!wordResult) | 457 if (!wordResult) |
| 457 continue; | 458 continue; |
| 458 totalOffset -= wordResult->numCharacters(); | 459 totalOffset -= wordResult->numCharacters(); |
| 459 if (targetX >= 0 && targetX <= wordResult->width()) { | 460 if (targetX >= 0 && targetX <= wordResult->width()) { |
| 460 int offsetForWord = wordResult->offsetForPosition(targetX); | 461 int offsetForWord = wordResult->offsetForPosition(targetX); |
| 461 return totalOffset + offsetForWord; | 462 return totalOffset + offsetForWord; |
| 462 } | 463 } |
| 463 targetX -= wordResult->width(); | 464 targetX -= wordResult->width(); |
| 464 } | 465 } |
| 465 } else { | 466 } else { |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 return spacing; | 1215 return spacing; |
| 1215 } | 1216 } |
| 1216 | 1217 |
| 1217 // Don't need to check m_textRun.allowsTrailingExpansion() since it's covere
d by !m_expansionOpportunityCount above | 1218 // Don't need to check m_textRun.allowsTrailingExpansion() since it's covere
d by !m_expansionOpportunityCount above |
| 1218 spacing += nextExpansionPerOpportunity(); | 1219 spacing += nextExpansionPerOpportunity(); |
| 1219 m_isAfterExpansion = true; | 1220 m_isAfterExpansion = true; |
| 1220 return spacing; | 1221 return spacing; |
| 1221 } | 1222 } |
| 1222 | 1223 |
| 1223 } // namespace blink | 1224 } // namespace blink |
| OLD | NEW |