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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 249 |
250 if (!offset_x && offset < num_characters) { | 250 if (!offset_x && offset < num_characters) { |
251 offset_x = runs_[i]->XPositionForVisualOffset(offset, kAdjustToEnd) + x; | 251 offset_x = runs_[i]->XPositionForVisualOffset(offset, kAdjustToEnd) + x; |
252 break; | 252 break; |
253 } | 253 } |
254 | 254 |
255 offset -= num_characters; | 255 offset -= num_characters; |
256 x += runs_[i]->width_; | 256 x += runs_[i]->width_; |
257 } | 257 } |
258 | 258 |
259 if (Rtl()) | |
260 x -= Width(); | |
261 | |
262 // The position in question might be just after the text. | 259 // The position in question might be just after the text. |
263 if (!offset_x && absolute_offset == NumCharacters()) | 260 if (!offset_x && absolute_offset == NumCharacters()) |
264 return Rtl() ? 0 : width_; | 261 return Rtl() ? 0 : width_; |
265 | 262 |
266 return offset_x; | 263 return offset_x; |
267 } | 264 } |
268 | 265 |
269 void ShapeResult::FallbackFonts( | 266 void ShapeResult::FallbackFonts( |
270 HashSet<const SimpleFontData*>* fallback) const { | 267 HashSet<const SimpleFontData*>* fallback) const { |
271 DCHECK(fallback); | 268 DCHECK(fallback); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 result->width_ = run->width_; | 468 result->width_ = run->width_; |
472 result->num_glyphs_ = count; | 469 result->num_glyphs_ = count; |
473 DCHECK_EQ(result->num_glyphs_, count); // no overflow | 470 DCHECK_EQ(result->num_glyphs_, count); // no overflow |
474 result->has_vertical_offsets_ = | 471 result->has_vertical_offsets_ = |
475 font_data->PlatformData().IsVerticalAnyUpright(); | 472 font_data->PlatformData().IsVerticalAnyUpright(); |
476 result->runs_.push_back(std::move(run)); | 473 result->runs_.push_back(std::move(run)); |
477 return result.Release(); | 474 return result.Release(); |
478 } | 475 } |
479 | 476 |
480 } // namespace blink | 477 } // namespace blink |
OLD | NEW |