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

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

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 years, 1 month 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 resolvers[index]->call(this); 321 resolvers[index]->call(this);
322 } 322 }
323 } 323 }
324 324
325 static const String& nullToSpace(const String& s) 325 static const String& nullToSpace(const String& s)
326 { 326 {
327 DEFINE_STATIC_LOCAL(String, space, (" ")); 327 DEFINE_STATIC_LOCAL(String, space, (" "));
328 return s.isNull() ? space : s; 328 return s.isNull() ? space : s;
329 } 329 }
330 330
331 Vector<RefPtr<FontFace> > FontFaceSet::match(const String& fontString, const Str ing& text, ExceptionState& es) 331 Vector<RefPtr<FontFace> > FontFaceSet::match(const String& fontString, const Str ing& text, ExceptionState& exceptionState)
332 { 332 {
333 Vector<RefPtr<FontFace> > matchedFonts; 333 Vector<RefPtr<FontFace> > matchedFonts;
334 334
335 Font font; 335 Font font;
336 if (!resolveFontStyle(fontString, font)) { 336 if (!resolveFontStyle(fontString, font)) {
337 es.throwUninformativeAndGenericDOMException(SyntaxError); 337 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
338 return matchedFonts; 338 return matchedFonts;
339 } 339 }
340 340
341 for (const FontFamily* f = &font.family(); f; f = f->next()) { 341 for (const FontFamily* f = &font.family(); f; f = f->next()) {
342 CSSSegmentedFontFace* face = document()->styleResolver()->fontSelector() ->getFontFace(font.fontDescription(), f->family()); 342 CSSSegmentedFontFace* face = document()->styleResolver()->fontSelector() ->getFontFace(font.fontDescription(), f->family());
343 if (face) 343 if (face)
344 matchedFonts.append(face->fontFaces(nullToSpace(text))); 344 matchedFonts.append(face->fontFaces(nullToSpace(text)));
345 } 345 }
346 return matchedFonts; 346 return matchedFonts;
347 } 347 }
348 348
349 ScriptPromise FontFaceSet::load(const String& fontString, const String& text, Ex ceptionState& es) 349 ScriptPromise FontFaceSet::load(const String& fontString, const String& text, Ex ceptionState& exceptionState)
350 { 350 {
351 Font font; 351 Font font;
352 if (!resolveFontStyle(fontString, font)) { 352 if (!resolveFontStyle(fontString, font)) {
353 es.throwUninformativeAndGenericDOMException(SyntaxError); 353 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
354 return ScriptPromise(); 354 return ScriptPromise();
355 } 355 }
356 356
357 Document* d = document(); 357 Document* d = document();
358 ScriptPromise promise = ScriptPromise::createPending(executionContext()); 358 ScriptPromise promise = ScriptPromise::createPending(executionContext());
359 RefPtr<LoadFontPromiseResolver> resolver = LoadFontPromiseResolver::create(f ont.family(), promise, executionContext()); 359 RefPtr<LoadFontPromiseResolver> resolver = LoadFontPromiseResolver::create(f ont.family(), promise, executionContext());
360 for (const FontFamily* f = &font.family(); f; f = f->next()) { 360 for (const FontFamily* f = &font.family(); f; f = f->next()) {
361 CSSSegmentedFontFace* face = d->styleResolver()->fontSelector()->getFont Face(font.fontDescription(), f->family()); 361 CSSSegmentedFontFace* face = d->styleResolver()->fontSelector()->getFont Face(font.fontDescription(), f->family());
362 if (!face) { 362 if (!face) {
363 resolver->error(d); 363 resolver->error(d);
364 continue; 364 continue;
365 } 365 }
366 face->loadFont(font.fontDescription(), nullToSpace(text), resolver); 366 face->loadFont(font.fontDescription(), nullToSpace(text), resolver);
367 } 367 }
368 return promise; 368 return promise;
369 } 369 }
370 370
371 bool FontFaceSet::check(const String& fontString, const String& text, ExceptionS tate& es) 371 bool FontFaceSet::check(const String& fontString, const String& text, ExceptionS tate& exceptionState)
372 { 372 {
373 Font font; 373 Font font;
374 if (!resolveFontStyle(fontString, font)) { 374 if (!resolveFontStyle(fontString, font)) {
375 es.throwUninformativeAndGenericDOMException(SyntaxError); 375 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
376 return false; 376 return false;
377 } 377 }
378 378
379 for (const FontFamily* f = &font.family(); f; f = f->next()) { 379 for (const FontFamily* f = &font.family(); f; f = f->next()) {
380 CSSSegmentedFontFace* face = document()->styleResolver()->fontSelector() ->getFontFace(font.fontDescription(), f->family()); 380 CSSSegmentedFontFace* face = document()->styleResolver()->fontSelector() ->getFontFace(font.fontDescription(), f->family());
381 if (!face || !face->checkFont(nullToSpace(text))) 381 if (!face || !face->checkFont(nullToSpace(text)))
382 return false; 382 return false;
383 } 383 }
384 return true; 384 return true;
385 } 385 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 455 }
456 456
457 void FontFaceSet::didLayout(Document* document) 457 void FontFaceSet::didLayout(Document* document)
458 { 458 {
459 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(SupplementType::from(docu ment, supplementName()))) 459 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(SupplementType::from(docu ment, supplementName())))
460 fonts->didLayout(); 460 fonts->didLayout();
461 } 461 }
462 462
463 463
464 } // namespace WebCore 464 } // 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