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

Side by Side Diff: sky/engine/core/css/FontFaceSet.cpp

Issue 838003008: Get rid of ensureStyleResolver(). (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | sky/engine/core/css/resolver/ScopedStyleResolver.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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 if (!fontFace) { 333 if (!fontFace) {
334 exceptionState.throwTypeError("The argument is not a FontFace."); 334 exceptionState.throwTypeError("The argument is not a FontFace.");
335 return false; 335 return false;
336 } 336 }
337 return m_nonCSSConnectedFaces.contains(fontFace) || isCSSConnectedFontFace(f ontFace); 337 return m_nonCSSConnectedFaces.contains(fontFace) || isCSSConnectedFontFace(f ontFace);
338 } 338 }
339 339
340 const ListHashSet<RefPtr<FontFace> >& FontFaceSet::cssConnectedFontFaceList() co nst 340 const ListHashSet<RefPtr<FontFace> >& FontFaceSet::cssConnectedFontFaceList() co nst
341 { 341 {
342 Document* d = document(); 342 Document* d = document();
343 d->ensureStyleResolver(); // Flush pending style changes.
344 return d->styleEngine()->fontSelector()->fontFaceCache()->cssConnectedFontFa ces(); 343 return d->styleEngine()->fontSelector()->fontFaceCache()->cssConnectedFontFa ces();
345 } 344 }
346 345
347 bool FontFaceSet::isCSSConnectedFontFace(FontFace* fontFace) const 346 bool FontFaceSet::isCSSConnectedFontFace(FontFace* fontFace) const
348 { 347 {
349 return cssConnectedFontFaceList().contains(fontFace); 348 return cssConnectedFontFaceList().contains(fontFace);
350 } 349 }
351 350
352 void FontFaceSet::forEach(PassOwnPtr<FontFaceSetForEachCallback> callback, const ScriptValue& thisArg) const 351 void FontFaceSet::forEach(PassOwnPtr<FontFaceSetForEachCallback> callback, const ScriptValue& thisArg) const
353 { 352 {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 // Now map the font property longhands into the style. 519 // Now map the font property longhands into the style.
521 CSSPropertyValue properties[] = { 520 CSSPropertyValue properties[] = {
522 CSSPropertyValue(CSSPropertyFontFamily, *parsedStyle), 521 CSSPropertyValue(CSSPropertyFontFamily, *parsedStyle),
523 CSSPropertyValue(CSSPropertyFontStretch, *parsedStyle), 522 CSSPropertyValue(CSSPropertyFontStretch, *parsedStyle),
524 CSSPropertyValue(CSSPropertyFontStyle, *parsedStyle), 523 CSSPropertyValue(CSSPropertyFontStyle, *parsedStyle),
525 CSSPropertyValue(CSSPropertyFontVariant, *parsedStyle), 524 CSSPropertyValue(CSSPropertyFontVariant, *parsedStyle),
526 CSSPropertyValue(CSSPropertyFontWeight, *parsedStyle), 525 CSSPropertyValue(CSSPropertyFontWeight, *parsedStyle),
527 CSSPropertyValue(CSSPropertyFontSize, *parsedStyle), 526 CSSPropertyValue(CSSPropertyFontSize, *parsedStyle),
528 CSSPropertyValue(CSSPropertyLineHeight, *parsedStyle), 527 CSSPropertyValue(CSSPropertyLineHeight, *parsedStyle),
529 }; 528 };
530 StyleResolver& styleResolver = document()->ensureStyleResolver(); 529 StyleResolver& styleResolver = document()->styleResolver();
531 styleResolver.applyPropertiesToStyle(properties, WTF_ARRAY_LENGTH(properties ), style.get()); 530 styleResolver.applyPropertiesToStyle(properties, WTF_ARRAY_LENGTH(properties ), style.get());
532 531
533 font = style->font(); 532 font = style->font();
534 font.update(document()->styleEngine()->fontSelector()); 533 font.update(document()->styleEngine()->fontSelector());
535 return true; 534 return true;
536 } 535 }
537 536
538 void FontFaceSet::FontLoadHistogram::updateStatus(FontFace* fontFace) 537 void FontFaceSet::FontLoadHistogram::updateStatus(FontFace* fontFace)
539 { 538 {
540 if (m_status == Reported) 539 if (m_status == Reported)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 return fonts.release(); 572 return fonts.release();
574 } 573 }
575 574
576 void FontFaceSet::didLayout(Document& document) 575 void FontFaceSet::didLayout(Document& document)
577 { 576 {
578 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(SupplementType::from(docu ment, supplementName()))) 577 if (FontFaceSet* fonts = static_cast<FontFaceSet*>(SupplementType::from(docu ment, supplementName())))
579 fonts->didLayout(); 578 fonts->didLayout();
580 } 579 }
581 580
582 } // namespace blink 581 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/css/resolver/ScopedStyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698