Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h

Issue 2875933006: [LayoutNG] Misc fixes in ShapingLineBreaker (Closed)
Patch Set: clang build fix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 static PassRefPtr<ShapeResult> CreateForTabulationCharacters( 60 static PassRefPtr<ShapeResult> CreateForTabulationCharacters(
61 const Font*, 61 const Font*,
62 const TextRun&, 62 const TextRun&,
63 float position_offset, 63 float position_offset,
64 unsigned count); 64 unsigned count);
65 ~ShapeResult(); 65 ~ShapeResult();
66 66
67 float Width() const { return width_; } 67 float Width() const { return width_; }
68 LayoutUnit SnappedWidth() const { return LayoutUnit::FromFloatCeil(width_); } 68 LayoutUnit SnappedWidth() const { return LayoutUnit::FromFloatCeil(width_); }
69 const FloatRect& Bounds() const { return glyph_bounding_box_; } 69 const FloatRect& Bounds() const { return glyph_bounding_box_; }
70 // The character start index of a range shape result.
71 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
70 unsigned NumCharacters() const { return num_characters_; } 72 unsigned NumCharacters() const { return num_characters_; }
71 void FallbackFonts(HashSet<const SimpleFontData*>*) const; 73 void FallbackFonts(HashSet<const SimpleFontData*>*) const;
72 TextDirection Direction() const { 74 TextDirection Direction() const {
73 return static_cast<TextDirection>(direction_); 75 return static_cast<TextDirection>(direction_);
74 } 76 }
75 bool Rtl() const { return Direction() == TextDirection::kRtl; } 77 bool Rtl() const { return Direction() == TextDirection::kRtl; }
76 bool HasVerticalOffsets() const { return has_vertical_offsets_; } 78 bool HasVerticalOffsets() const { return has_vertical_offsets_; }
77 79
78 // For memory reporting. 80 // For memory reporting.
79 size_t ByteSize() const; 81 size_t ByteSize() const;
80 82
83 enum OffsetOptions {
84 // If the position is outside of this result, returns the start or the end
85 // offset depends on the position.
86 kOutsideAsStartOrEnd,
87 // If the position is outside of this result, returns the most right offset.
88 kOutsideAsRight,
89 };
90 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
81 unsigned OffsetForPosition(float target_x, bool include_partial_glyphs) const; 91 unsigned OffsetForPosition(float target_x, bool include_partial_glyphs) const;
82 float PositionForOffset(unsigned offset) const; 92 float PositionForOffset(unsigned offset) const;
83 LayoutUnit SnappedStartPositionForOffset(unsigned offset) const { 93 LayoutUnit SnappedStartPositionForOffset(unsigned offset) const {
84 return LayoutUnit::FromFloatFloor(PositionForOffset(offset)); 94 return LayoutUnit::FromFloatFloor(PositionForOffset(offset));
85 } 95 }
86 LayoutUnit SnappedEndPositionForOffset(unsigned offset) const { 96 LayoutUnit SnappedEndPositionForOffset(unsigned offset) const {
87 return LayoutUnit::FromFloatCeil(PositionForOffset(offset)); 97 return LayoutUnit::FromFloatCeil(PositionForOffset(offset));
88 } 98 }
89 99
90 PassRefPtr<ShapeResult> ApplySpacingToCopy(ShapeResultSpacing&, 100 PassRefPtr<ShapeResult> ApplySpacingToCopy(ShapeResultSpacing&,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 unsigned has_vertical_offsets_ : 1; 135 unsigned has_vertical_offsets_ : 1;
126 136
127 friend class HarfBuzzShaper; 137 friend class HarfBuzzShaper;
128 friend class ShapeResultBuffer; 138 friend class ShapeResultBuffer;
129 friend class ShapeResultBloberizer; 139 friend class ShapeResultBloberizer;
130 }; 140 };
131 141
132 } // namespace blink 142 } // namespace blink
133 143
134 #endif // ShapeResult_h 144 #endif // ShapeResult_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698