Chromium Code Reviews| Index: third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h |
| diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h |
| index b6923ef937d9907360a26a68e6d34b09bb4c0b3f..8ce29a181949413d690beee62a5f48f4de2505e7 100644 |
| --- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h |
| +++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h |
| @@ -67,6 +67,8 @@ class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> { |
| float Width() const { return width_; } |
| LayoutUnit SnappedWidth() const { return LayoutUnit::FromFloatCeil(width_); } |
| const FloatRect& Bounds() const { return glyph_bounding_box_; } |
| + // The character start index of a range shape result. |
| + unsigned CharacterStartIndex() const; |
|
eae
2017/05/12 18:45:49
CharacterOffset perhaps and CharacterLength for (N
kojii
2017/05/12 19:08:13
Existing functions such as OffsetForPosition() use
eae
2017/05/12 21:24:05
Ah, fair enough. Perhaps we could be even more exp
|
| unsigned NumCharacters() const { return num_characters_; } |
| void FallbackFonts(HashSet<const SimpleFontData*>*) const; |
| TextDirection Direction() const { |
| @@ -78,6 +80,14 @@ class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> { |
| // For memory reporting. |
| size_t ByteSize() const; |
| + enum OffsetOptions { |
| + // If the position is outside of this result, returns the start or the end |
| + // offset depends on the position. |
| + kOutsideAsStartOrEnd, |
| + // If the position is outside of this result, returns the most right offset. |
| + kOutsideAsRight, |
| + }; |
| + unsigned OffsetForPosition(float target_x, OffsetOptions) const; |
|
eae
2017/05/12 18:45:49
Isn't kOutsideAsStartOrEnd always the desirable be
kojii
2017/05/12 19:08:13
I think so, but there are bunch of existing caller
|
| unsigned OffsetForPosition(float target_x, bool include_partial_glyphs) const; |
| float PositionForOffset(unsigned offset) const; |
| LayoutUnit SnappedStartPositionForOffset(unsigned offset) const { |