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

Side by Side Diff: Source/core/platform/graphics/GlyphPageTreeNode.cpp

Issue 23446007: Use unicode-range to prevent unnecessary @font-face donwnloads (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase and add toSegmentedFontData() Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 bool zeroFilled = false; 219 bool zeroFilled = false;
220 RefPtr<GlyphPage> scratchPage; 220 RefPtr<GlyphPage> scratchPage;
221 GlyphPage* pageToFill = m_page.get(); 221 GlyphPage* pageToFill = m_page.get();
222 for (unsigned i = 0; i < numRanges; i++) { 222 for (unsigned i = 0; i < numRanges; i++) {
223 const FontDataRange& range = segmentedFontData->rangeAt(i); 223 const FontDataRange& range = segmentedFontData->rangeAt(i);
224 // all this casting is to ensure all the parameters to min a nd max have the same type, 224 // all this casting is to ensure all the parameters to min a nd max have the same type,
225 // to avoid ambiguous template parameter errors on Windows 225 // to avoid ambiguous template parameter errors on Windows
226 int from = max(0, static_cast<int>(range.from()) - static_ca st<int>(start)); 226 int from = max(0, static_cast<int>(range.from()) - static_ca st<int>(start));
227 int to = 1 + min(static_cast<int>(range.to()) - static_cast< int>(start), static_cast<int>(GlyphPage::size) - 1); 227 int to = 1 + min(static_cast<int>(range.to()) - static_cast< int>(start), static_cast<int>(GlyphPage::size) - 1);
228 if (from < static_cast<int>(GlyphPage::size) && to > 0) { 228 if (from < static_cast<int>(GlyphPage::size) && to > 0) {
229 // If this is a custom font needs to be loaded, kick off
230 // the load here, and do not fill the page so that
231 // font fallback is used while loading.
232 if (range.fontData()->isLoadingFallback()) {
233 range.fontData()->beginLoadIfNeeded();
234 continue;
235 }
236
229 if (haveGlyphs && !scratchPage) { 237 if (haveGlyphs && !scratchPage) {
230 scratchPage = GlyphPage::createForMixedFontData(this ); 238 scratchPage = GlyphPage::createForMixedFontData(this );
231 pageToFill = scratchPage.get(); 239 pageToFill = scratchPage.get();
232 } 240 }
233 241
234 if (!zeroFilled) { 242 if (!zeroFilled) {
235 if (from > 0 || to < static_cast<int>(GlyphPage::siz e)) { 243 if (from > 0 || to < static_cast<int>(GlyphPage::siz e)) {
236 for (unsigned i = 0; i < GlyphPage::size; i++) 244 for (unsigned i = 0; i < GlyphPage::size; i++)
237 pageToFill->setGlyphDataForIndex(i, 0, 0); 245 pageToFill->setGlyphDataForIndex(i, 0, 0);
238 } 246 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 printf("\nPage %d:\n", it->key); 428 printf("\nPage %d:\n", it->key);
421 showGlyphPageTree(it->key); 429 showGlyphPageTree(it->key);
422 } 430 }
423 } 431 }
424 432
425 void showGlyphPageTree(unsigned pageNumber) 433 void showGlyphPageTree(unsigned pageNumber)
426 { 434 {
427 WebCore::GlyphPageTreeNode::getRoot(pageNumber)->showSubtree(); 435 WebCore::GlyphPageTreeNode::getRoot(pageNumber)->showSubtree();
428 } 436 }
429 #endif 437 #endif
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/FontFallbackList.cpp ('k') | Source/core/platform/graphics/SegmentedFontData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698