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

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

Issue 2807913002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/fonts (Closed)
Patch Set: rebase Created 3 years, 8 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 // 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/FontFallbackIterator.h" 5 #include "platform/fonts/FontFallbackIterator.h"
6 6
7 #include "platform/fonts/FontCache.h" 7 #include "platform/fonts/FontCache.h"
8 #include "platform/fonts/FontDescription.h" 8 #include "platform/fonts/FontDescription.h"
9 #include "platform/fonts/FontFallbackList.h" 9 #include "platform/fonts/FontFallbackList.h"
10 #include "platform/fonts/SegmentedFontData.h" 10 #include "platform/fonts/SegmentedFontData.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 fallback_stage_ = kOutOfLuck; 116 fallback_stage_ = kOutOfLuck;
117 RefPtr<SimpleFontData> last_resort = 117 RefPtr<SimpleFontData> last_resort =
118 font_cache->GetLastResortFallbackFont(font_description_).Get(); 118 font_cache->GetLastResortFallbackFont(font_description_).Get();
119 if (!last_resort) 119 if (!last_resort)
120 FontCache::CrashWithFontInfo(&font_description_); 120 FontCache::CrashWithFontInfo(&font_description_);
121 // Don't skip the LastResort font in uniqueOrNext() since HarfBuzzShaper 121 // Don't skip the LastResort font in uniqueOrNext() since HarfBuzzShaper
122 // needs to use this one to place missing glyph boxes. 122 // needs to use this one to place missing glyph boxes.
123 return AdoptRef(new FontDataForRangeSetFromCache(last_resort)); 123 return AdoptRef(new FontDataForRangeSetFromCache(last_resort));
124 } 124 }
125 125
126 ASSERT(fallback_stage_ == kFontGroupFonts || 126 DCHECK(fallback_stage_ == kFontGroupFonts ||
127 fallback_stage_ == kSegmentedFace); 127 fallback_stage_ == kSegmentedFace);
128 const FontData* font_data = font_fallback_list_->FontDataAt( 128 const FontData* font_data = font_fallback_list_->FontDataAt(
129 font_description_, current_font_data_index_); 129 font_description_, current_font_data_index_);
130 130
131 if (!font_data) { 131 if (!font_data) {
132 // If there is no fontData coming from the fallback list, it means 132 // If there is no fontData coming from the fallback list, it means
133 // we are now looking at system fonts, either for prioritized symbol 133 // we are now looking at system fonts, either for prioritized symbol
134 // or emoji fonts or by calling system fallback API. 134 // or emoji fonts or by calling system fallback API.
135 fallback_stage_ = IsNonTextFallbackPriority(font_fallback_priority_) 135 fallback_stage_ = IsNonTextFallbackPriority(font_fallback_priority_)
136 ? kFallbackPriorityFonts 136 ? kFallbackPriorityFonts
(...skipping 19 matching lines...) Expand all
156 } 156 }
157 157
158 // Iterate over ranges of a segmented font below. 158 // Iterate over ranges of a segmented font below.
159 159
160 const SegmentedFontData* segmented = ToSegmentedFontData(font_data); 160 const SegmentedFontData* segmented = ToSegmentedFontData(font_data);
161 if (fallback_stage_ != kSegmentedFace) { 161 if (fallback_stage_ != kSegmentedFace) {
162 segmented_face_index_ = 0; 162 segmented_face_index_ = 0;
163 fallback_stage_ = kSegmentedFace; 163 fallback_stage_ = kSegmentedFace;
164 } 164 }
165 165
166 ASSERT(segmented_face_index_ < segmented->NumFaces()); 166 DCHECK_LT(segmented_face_index_, segmented->NumFaces());
167 RefPtr<FontDataForRangeSet> current_segmented_face = 167 RefPtr<FontDataForRangeSet> current_segmented_face =
168 segmented->FaceAt(segmented_face_index_); 168 segmented->FaceAt(segmented_face_index_);
169 segmented_face_index_++; 169 segmented_face_index_++;
170 170
171 if (segmented_face_index_ == segmented->NumFaces()) { 171 if (segmented_face_index_ == segmented->NumFaces()) {
172 // Switch from iterating over a segmented face to the next family from 172 // Switch from iterating over a segmented face to the next family from
173 // the font-family: group of fonts. 173 // the font-family: group of fonts.
174 fallback_stage_ = kFontGroupFonts; 174 fallback_stage_ = kFontGroupFonts;
175 current_font_data_index_++; 175 current_font_data_index_++;
176 } 176 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 if (!hint || previously_asked_for_hint_.Contains(hint)) 237 if (!hint || previously_asked_for_hint_.Contains(hint))
238 return nullptr; 238 return nullptr;
239 previously_asked_for_hint_.insert(hint); 239 previously_asked_for_hint_.insert(hint);
240 return font_cache->FallbackFontForCharacter( 240 return font_cache->FallbackFontForCharacter(
241 font_description_, hint, 241 font_description_, hint,
242 font_fallback_list_->PrimarySimpleFontData(font_description_)); 242 font_fallback_list_->PrimarySimpleFontData(font_description_));
243 } 243 }
244 244
245 } // namespace blink 245 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698