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

Side by Side Diff: Source/core/css/FontFaceSet.cpp

Issue 24469004: Amusingly deprecate the generic version of 'ExceptionState::throwDOMException'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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
« no previous file with comments | « Source/core/css/FontFace.cpp ('k') | Source/core/css/MediaList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 met: 5 * modification, are permitted provided that the following conditions are met:
6 * 6 *
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 336 }
337 } 337 }
338 338
339 Vector<RefPtr<FontFace> > FontFaceSet::match(const String& fontString, const Str ing&, ExceptionState& es) 339 Vector<RefPtr<FontFace> > FontFaceSet::match(const String& fontString, const Str ing&, ExceptionState& es)
340 { 340 {
341 // FIXME: The second parameter (text) is ignored. 341 // FIXME: The second parameter (text) is ignored.
342 Vector<RefPtr<FontFace> > matchedFonts; 342 Vector<RefPtr<FontFace> > matchedFonts;
343 343
344 Font font; 344 Font font;
345 if (!resolveFontStyle(fontString, font)) { 345 if (!resolveFontStyle(fontString, font)) {
346 es.throwDOMException(SyntaxError); 346 es.throwUninformativeAndGenericDOMException(SyntaxError);
347 return matchedFonts; 347 return matchedFonts;
348 } 348 }
349 349
350 for (const FontFamily* f = &font.family(); f; f = f->next()) { 350 for (const FontFamily* f = &font.family(); f; f = f->next()) {
351 CSSSegmentedFontFace* face = document()->styleResolver()->fontSelector() ->getFontFace(font.fontDescription(), f->family()); 351 CSSSegmentedFontFace* face = document()->styleResolver()->fontSelector() ->getFontFace(font.fontDescription(), f->family());
352 if (face) 352 if (face)
353 matchedFonts.append(face->fontFaces()); 353 matchedFonts.append(face->fontFaces());
354 } 354 }
355 return matchedFonts; 355 return matchedFonts;
356 } 356 }
357 357
358 ScriptPromise FontFaceSet::load(const String& fontString, const String&, Excepti onState& es) 358 ScriptPromise FontFaceSet::load(const String& fontString, const String&, Excepti onState& es)
359 { 359 {
360 // FIXME: The second parameter (text) is ignored. 360 // FIXME: The second parameter (text) is ignored.
361 Font font; 361 Font font;
362 if (!resolveFontStyle(fontString, font)) { 362 if (!resolveFontStyle(fontString, font)) {
363 es.throwDOMException(SyntaxError); 363 es.throwUninformativeAndGenericDOMException(SyntaxError);
364 return ScriptPromise(); 364 return ScriptPromise();
365 } 365 }
366 366
367 Document* d = document(); 367 Document* d = document();
368 RefPtr<LoadFontPromiseResolver> resolver = LoadFontPromiseResolver::create(f ont.family(), scriptExecutionContext()); 368 RefPtr<LoadFontPromiseResolver> resolver = LoadFontPromiseResolver::create(f ont.family(), scriptExecutionContext());
369 for (const FontFamily* f = &font.family(); f; f = f->next()) { 369 for (const FontFamily* f = &font.family(); f; f = f->next()) {
370 CSSSegmentedFontFace* face = d->styleResolver()->fontSelector()->getFont Face(font.fontDescription(), f->family()); 370 CSSSegmentedFontFace* face = d->styleResolver()->fontSelector()->getFont Face(font.fontDescription(), f->family());
371 if (!face) { 371 if (!face) {
372 resolver->error(d); 372 resolver->error(d);
373 continue; 373 continue;
374 } 374 }
375 face->loadFont(font.fontDescription(), resolver); 375 face->loadFont(font.fontDescription(), resolver);
376 } 376 }
377 return resolver->promise(); 377 return resolver->promise();
378 } 378 }
379 379
380 bool FontFaceSet::check(const String& fontString, const String&, ExceptionState& es) 380 bool FontFaceSet::check(const String& fontString, const String&, ExceptionState& es)
381 { 381 {
382 // FIXME: The second parameter (text) is ignored. 382 // FIXME: The second parameter (text) is ignored.
383 Font font; 383 Font font;
384 if (!resolveFontStyle(fontString, font)) { 384 if (!resolveFontStyle(fontString, font)) {
385 es.throwDOMException(SyntaxError); 385 es.throwUninformativeAndGenericDOMException(SyntaxError);
386 return false; 386 return false;
387 } 387 }
388 388
389 for (const FontFamily* f = &font.family(); f; f = f->next()) { 389 for (const FontFamily* f = &font.family(); f; f = f->next()) {
390 CSSSegmentedFontFace* face = document()->styleResolver()->fontSelector() ->getFontFace(font.fontDescription(), f->family()); 390 CSSSegmentedFontFace* face = document()->styleResolver()->fontSelector() ->getFontFace(font.fontDescription(), f->family());
391 if (!face || !face->checkFont()) 391 if (!face || !face->checkFont())
392 return false; 392 return false;
393 } 393 }
394 return true; 394 return true;
395 } 395 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 442
443 void FontFaceSet::FontLoadHistogram::record() 443 void FontFaceSet::FontLoadHistogram::record()
444 { 444 {
445 if (m_recorded) 445 if (m_recorded)
446 return; 446 return;
447 m_recorded = true; 447 m_recorded = true;
448 HistogramSupport::histogramCustomCounts("WebFont.WebFontsInPage", m_count, 1 , 100, 50); 448 HistogramSupport::histogramCustomCounts("WebFont.WebFontsInPage", m_count, 1 , 100, 50);
449 } 449 }
450 450
451 } // namespace WebCore 451 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/FontFace.cpp ('k') | Source/core/css/MediaList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698