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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/ShapeResultTestInfo.cpp

Issue 2869893005: Clamp RunInfo::num_characters when shaping ranges with context (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/shaping/ShapeResultTestInfo.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/fonts/shaping/ShapeResultTestInfo.h" 5 #include "platform/fonts/shaping/ShapeResultTestInfo.h"
6 6
7 #include "platform/fonts/Font.h" 7 #include "platform/fonts/Font.h"
8 #include "platform/fonts/shaping/ShapeResultInlineHeaders.h" 8 #include "platform/fonts/shaping/ShapeResultInlineHeaders.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 unsigned ShapeResultTestInfo::NumberOfRunsForTesting() const { 12 unsigned ShapeResultTestInfo::NumberOfRunsForTesting() const {
13 return runs_.size(); 13 return runs_.size();
14 } 14 }
15 15
16 bool ShapeResultTestInfo::RunInfoForTesting(unsigned run_index, 16 bool ShapeResultTestInfo::RunInfoForTesting(unsigned run_index,
17 unsigned& start_index, 17 unsigned& start_index,
18 unsigned& num_characters,
18 unsigned& num_glyphs, 19 unsigned& num_glyphs,
19 hb_script_t& script) const { 20 hb_script_t& script) const {
20 if (run_index < runs_.size() && runs_[run_index]) { 21 if (run_index < runs_.size() && runs_[run_index]) {
21 start_index = runs_[run_index]->start_index_; 22 start_index = runs_[run_index]->start_index_;
23 num_characters = runs_[run_index]->num_characters_;
22 num_glyphs = runs_[run_index]->glyph_data_.size(); 24 num_glyphs = runs_[run_index]->glyph_data_.size();
23 script = runs_[run_index]->script_; 25 script = runs_[run_index]->script_;
24 return true; 26 return true;
25 } 27 }
26 return false; 28 return false;
27 } 29 }
28 30
31 bool ShapeResultTestInfo::RunInfoForTesting(unsigned run_index,
32 unsigned& start_index,
33 unsigned& num_glyphs,
34 hb_script_t& script) const {
35 unsigned num_characters;
36 return RunInfoForTesting(run_index, start_index, num_characters, num_glyphs,
37 script);
38 }
39
29 uint16_t ShapeResultTestInfo::GlyphForTesting(unsigned run_index, 40 uint16_t ShapeResultTestInfo::GlyphForTesting(unsigned run_index,
30 size_t glyph_index) const { 41 size_t glyph_index) const {
31 return runs_[run_index]->glyph_data_[glyph_index].glyph; 42 return runs_[run_index]->glyph_data_[glyph_index].glyph;
32 } 43 }
33 44
34 float ShapeResultTestInfo::AdvanceForTesting(unsigned run_index, 45 float ShapeResultTestInfo::AdvanceForTesting(unsigned run_index,
35 size_t glyph_index) const { 46 size_t glyph_index) const {
36 return runs_[run_index]->glyph_data_[glyph_index].advance; 47 return runs_[run_index]->glyph_data_[glyph_index].advance;
37 } 48 }
38 49
39 SimpleFontData* ShapeResultTestInfo::FontDataForTesting( 50 SimpleFontData* ShapeResultTestInfo::FontDataForTesting(
40 unsigned run_index) const { 51 unsigned run_index) const {
41 return runs_[run_index]->font_data_.Get(); 52 return runs_[run_index]->font_data_.Get();
42 } 53 }
43 54
44 } // namespace blink 55 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/shaping/ShapeResultTestInfo.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698