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

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

Issue 1774943003: blink: Rename platform/ methods to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-platform: rebase-yayyyyyyyy Created 4 years, 9 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 /* 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 Font font; 378 Font font;
379 if (!resolveFontStyle(fontString, font)) { 379 if (!resolveFontStyle(fontString, font)) {
380 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptSt ate); 380 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptSt ate);
381 ScriptPromise promise = resolver->promise(); 381 ScriptPromise promise = resolver->promise();
382 resolver->reject(DOMException::create(SyntaxError, "Could not resolve '" + fontString + "' as a font.")); 382 resolver->reject(DOMException::create(SyntaxError, "Could not resolve '" + fontString + "' as a font."));
383 return promise; 383 return promise;
384 } 384 }
385 385
386 FontFaceCache* fontFaceCache = document()->styleEngine().fontSelector()->fon tFaceCache(); 386 FontFaceCache* fontFaceCache = document()->styleEngine().fontSelector()->fon tFaceCache();
387 FontFaceArray faces; 387 FontFaceArray faces;
388 for (const FontFamily* f = &font.fontDescription().family(); f; f = f->next( )) { 388 for (const FontFamily* f = &font.getFontDescription().family(); f; f = f->ne xt()) {
389 CSSSegmentedFontFace* segmentedFontFace = fontFaceCache->get(font.fontDe scription(), f->family()); 389 CSSSegmentedFontFace* segmentedFontFace = fontFaceCache->get(font.getFon tDescription(), f->family());
390 if (segmentedFontFace) 390 if (segmentedFontFace)
391 segmentedFontFace->match(text, faces); 391 segmentedFontFace->match(text, faces);
392 } 392 }
393 393
394 RefPtrWillBeRawPtr<LoadFontPromiseResolver> resolver = LoadFontPromiseResolv er::create(faces, scriptState); 394 RefPtrWillBeRawPtr<LoadFontPromiseResolver> resolver = LoadFontPromiseResolv er::create(faces, scriptState);
395 ScriptPromise promise = resolver->promise(); 395 ScriptPromise promise = resolver->promise();
396 resolver->loadFonts(getExecutionContext()); // After this, resolver->promise () may return null. 396 resolver->loadFonts(getExecutionContext()); // After this, resolver->promise () may return null.
397 return promise; 397 return promise;
398 } 398 }
399 399
400 bool FontFaceSet::check(const String& fontString, const String& text, ExceptionS tate& exceptionState) 400 bool FontFaceSet::check(const String& fontString, const String& text, ExceptionS tate& exceptionState)
401 { 401 {
402 if (!inActiveDocumentContext()) 402 if (!inActiveDocumentContext())
403 return false; 403 return false;
404 404
405 Font font; 405 Font font;
406 if (!resolveFontStyle(fontString, font)) { 406 if (!resolveFontStyle(fontString, font)) {
407 exceptionState.throwDOMException(SyntaxError, "Could not resolve '" + fo ntString + "' as a font."); 407 exceptionState.throwDOMException(SyntaxError, "Could not resolve '" + fo ntString + "' as a font.");
408 return false; 408 return false;
409 } 409 }
410 410
411 CSSFontSelector* fontSelector = document()->styleEngine().fontSelector(); 411 CSSFontSelector* fontSelector = document()->styleEngine().fontSelector();
412 FontFaceCache* fontFaceCache = fontSelector->fontFaceCache(); 412 FontFaceCache* fontFaceCache = fontSelector->fontFaceCache();
413 413
414 bool hasLoadedFaces = false; 414 bool hasLoadedFaces = false;
415 for (const FontFamily* f = &font.fontDescription().family(); f; f = f->next( )) { 415 for (const FontFamily* f = &font.getFontDescription().family(); f; f = f->ne xt()) {
416 CSSSegmentedFontFace* face = fontFaceCache->get(font.fontDescription(), f->family()); 416 CSSSegmentedFontFace* face = fontFaceCache->get(font.getFontDescription( ), f->family());
417 if (face) { 417 if (face) {
418 if (!face->checkFont(text)) 418 if (!face->checkFont(text))
419 return false; 419 return false;
420 hasLoadedFaces = true; 420 hasLoadedFaces = true;
421 } 421 }
422 } 422 }
423 if (hasLoadedFaces) 423 if (hasLoadedFaces)
424 return true; 424 return true;
425 for (const FontFamily* f = &font.fontDescription().family(); f; f = f->next( )) { 425 for (const FontFamily* f = &font.getFontDescription().family(); f; f = f->ne xt()) {
426 if (fontSelector->isPlatformFontAvailable(font.fontDescription(), f->fam ily())) 426 if (fontSelector->isPlatformFontAvailable(font.getFontDescription(), f-> family()))
427 return true; 427 return true;
428 } 428 }
429 return false; 429 return false;
430 } 430 }
431 431
432 bool FontFaceSet::resolveFontStyle(const String& fontString, Font& font) 432 bool FontFaceSet::resolveFontStyle(const String& fontString, Font& font)
433 { 433 {
434 if (fontString.isEmpty()) 434 if (fontString.isEmpty())
435 return false; 435 return false;
436 436
(...skipping 12 matching lines...) Expand all
449 FontFamily fontFamily; 449 FontFamily fontFamily;
450 fontFamily.setFamily(defaultFontFamily); 450 fontFamily.setFamily(defaultFontFamily);
451 451
452 FontDescription defaultFontDescription; 452 FontDescription defaultFontDescription;
453 defaultFontDescription.setFamily(fontFamily); 453 defaultFontDescription.setFamily(fontFamily);
454 defaultFontDescription.setSpecifiedSize(defaultFontSize); 454 defaultFontDescription.setSpecifiedSize(defaultFontSize);
455 defaultFontDescription.setComputedSize(defaultFontSize); 455 defaultFontDescription.setComputedSize(defaultFontSize);
456 456
457 style->setFontDescription(defaultFontDescription); 457 style->setFontDescription(defaultFontDescription);
458 458
459 style->font().update(style->font().fontSelector()); 459 style->font().update(style->font().getFontSelector());
460 460
461 document()->ensureStyleResolver().computeFont(style.get(), *parsedStyle); 461 document()->ensureStyleResolver().computeFont(style.get(), *parsedStyle);
462 462
463 font = style->font(); 463 font = style->font();
464 font.update(document()->styleEngine().fontSelector()); 464 font.update(document()->styleEngine().fontSelector());
465 return true; 465 return true;
466 } 466 }
467 467
468 void FontFaceSet::FontLoadHistogram::updateStatus(FontFace* fontFace) 468 void FontFaceSet::FontLoadHistogram::updateStatus(FontFace* fontFace)
469 { 469 {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 visitor->trace(m_failedFonts); 545 visitor->trace(m_failedFonts);
546 visitor->trace(m_nonCSSConnectedFaces); 546 visitor->trace(m_nonCSSConnectedFaces);
547 visitor->trace(m_asyncRunner); 547 visitor->trace(m_asyncRunner);
548 HeapSupplement<Document>::trace(visitor); 548 HeapSupplement<Document>::trace(visitor);
549 #endif 549 #endif
550 EventTargetWithInlineData::trace(visitor); 550 EventTargetWithInlineData::trace(visitor);
551 ActiveDOMObject::trace(visitor); 551 ActiveDOMObject::trace(visitor);
552 } 552 }
553 553
554 } // namespace blink 554 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698