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

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

Issue 337343002: IDL: make optional arguments (without default) explicit sometimes Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-default-arguments-next
Patch Set: Created 6 years, 4 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 | « Source/core/css/FontFaceSet.h ('k') | Source/core/css/MediaQueryList.idl » ('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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 Document* d = document(); 350 Document* d = document();
351 d->ensureStyleResolver(); // Flush pending style changes. 351 d->ensureStyleResolver(); // Flush pending style changes.
352 return d->styleEngine()->fontSelector()->fontFaceCache()->cssConnectedFontFa ces(); 352 return d->styleEngine()->fontSelector()->fontFaceCache()->cssConnectedFontFa ces();
353 } 353 }
354 354
355 bool FontFaceSet::isCSSConnectedFontFace(FontFace* fontFace) const 355 bool FontFaceSet::isCSSConnectedFontFace(FontFace* fontFace) const
356 { 356 {
357 return cssConnectedFontFaceList().contains(fontFace); 357 return cssConnectedFontFaceList().contains(fontFace);
358 } 358 }
359 359
360 void FontFaceSet::forEach(PassOwnPtr<FontFaceSetForEachCallback> callback, Scrip tValue& thisArg) const 360 void FontFaceSet::forEach(PassOwnPtr<FontFaceSetForEachCallback> callback, const Optional<ScriptValue>& thisArg) const
361 {
362 forEachInternal(callback, &thisArg);
363 }
364
365 void FontFaceSet::forEach(PassOwnPtr<FontFaceSetForEachCallback> callback) const
366 {
367 forEachInternal(callback, 0);
368 }
369
370 void FontFaceSet::forEachInternal(PassOwnPtr<FontFaceSetForEachCallback> callbac k, ScriptValue* thisArg) const
371 { 361 {
372 if (!inActiveDocumentContext()) 362 if (!inActiveDocumentContext())
373 return; 363 return;
374 const WillBeHeapListHashSet<RefPtrWillBeMember<FontFace> >& cssConnectedFace s = cssConnectedFontFaceList(); 364 const WillBeHeapListHashSet<RefPtrWillBeMember<FontFace> >& cssConnectedFace s = cssConnectedFontFaceList();
375 WillBeHeapVector<RefPtrWillBeMember<FontFace> > fontFaces; 365 WillBeHeapVector<RefPtrWillBeMember<FontFace> > fontFaces;
376 fontFaces.reserveInitialCapacity(cssConnectedFaces.size() + m_nonCSSConnecte dFaces.size()); 366 fontFaces.reserveInitialCapacity(cssConnectedFaces.size() + m_nonCSSConnecte dFaces.size());
377 for (WillBeHeapListHashSet<RefPtrWillBeMember<FontFace> >::const_iterator it = cssConnectedFaces.begin(); it != cssConnectedFaces.end(); ++it) 367 for (WillBeHeapListHashSet<RefPtrWillBeMember<FontFace> >::const_iterator it = cssConnectedFaces.begin(); it != cssConnectedFaces.end(); ++it)
378 fontFaces.append(*it); 368 fontFaces.append(*it);
379 for (WillBeHeapListHashSet<RefPtrWillBeMember<FontFace> >::const_iterator it = m_nonCSSConnectedFaces.begin(); it != m_nonCSSConnectedFaces.end(); ++it) 369 for (WillBeHeapListHashSet<RefPtrWillBeMember<FontFace> >::const_iterator it = m_nonCSSConnectedFaces.begin(); it != m_nonCSSConnectedFaces.end(); ++it)
380 fontFaces.append(*it); 370 fontFaces.append(*it);
381 371
382 for (size_t i = 0; i < fontFaces.size(); ++i) { 372 for (size_t i = 0; i < fontFaces.size(); ++i) {
383 FontFace* face = fontFaces[i].get(); 373 FontFace* face = fontFaces[i].get();
384 if (thisArg) 374 if (thisArg.isMissing())
385 callback->handleItem(*thisArg, face, face, const_cast<FontFaceSet*>( this)); 375 callback->handleItem(face, face, const_cast<FontFaceSet*>(this));
386 else 376 else
387 callback->handleItem(face, face, const_cast<FontFaceSet*>(this)); 377 callback->handleItem(thisArg.get(), face, face, const_cast<FontFaceS et*>(this));
388 } 378 }
389 } 379 }
390 380
391 unsigned long FontFaceSet::size() const 381 unsigned long FontFaceSet::size() const
392 { 382 {
393 if (!inActiveDocumentContext()) 383 if (!inActiveDocumentContext())
394 return m_nonCSSConnectedFaces.size(); 384 return m_nonCSSConnectedFaces.size();
395 return cssConnectedFontFaceList().size() + m_nonCSSConnectedFaces.size(); 385 return cssConnectedFontFaceList().size() + m_nonCSSConnectedFaces.size();
396 } 386 }
397 387
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 visitor->trace(m_loadingFonts); 583 visitor->trace(m_loadingFonts);
594 visitor->trace(m_loadedFonts); 584 visitor->trace(m_loadedFonts);
595 visitor->trace(m_failedFonts); 585 visitor->trace(m_failedFonts);
596 visitor->trace(m_nonCSSConnectedFaces); 586 visitor->trace(m_nonCSSConnectedFaces);
597 DocumentSupplement::trace(visitor); 587 DocumentSupplement::trace(visitor);
598 EventTargetWithInlineData::trace(visitor); 588 EventTargetWithInlineData::trace(visitor);
599 } 589 }
600 #endif 590 #endif
601 591
602 } // namespace blink 592 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/FontFaceSet.h ('k') | Source/core/css/MediaQueryList.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698