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

Side by Side Diff: Source/core/layout/TextAutosizer.cpp

Issue 1062283002: Use C++11 range-based loop for core/layout (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix it naming Created 5 years, 8 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 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 780
781 ASSERT(cluster->m_multiplier); 781 ASSERT(cluster->m_multiplier);
782 return cluster->m_multiplier; 782 return cluster->m_multiplier;
783 } 783 }
784 784
785 bool TextAutosizer::superclusterHasEnoughTextToAutosize(Supercluster* superclust er, const LayoutBlock* widthProvider) 785 bool TextAutosizer::superclusterHasEnoughTextToAutosize(Supercluster* superclust er, const LayoutBlock* widthProvider)
786 { 786 {
787 if (supercluster->m_hasEnoughTextToAutosize != UnknownAmountOfText) 787 if (supercluster->m_hasEnoughTextToAutosize != UnknownAmountOfText)
788 return supercluster->m_hasEnoughTextToAutosize == HasEnoughText; 788 return supercluster->m_hasEnoughTextToAutosize == HasEnoughText;
789 789
790 BlockSet::iterator end = supercluster->m_roots->end(); 790 for (auto* root : *supercluster->m_roots) {
791 for (BlockSet::iterator it = supercluster->m_roots->begin(); it != end; ++it ) { 791 if (clusterWouldHaveEnoughTextToAutosize(root, widthProvider)) {
792 if (clusterWouldHaveEnoughTextToAutosize(*it, widthProvider)) {
793 supercluster->m_hasEnoughTextToAutosize = HasEnoughText; 792 supercluster->m_hasEnoughTextToAutosize = HasEnoughText;
794 return true; 793 return true;
795 } 794 }
796 } 795 }
797 supercluster->m_hasEnoughTextToAutosize = NotEnoughText; 796 supercluster->m_hasEnoughTextToAutosize = NotEnoughText;
798 return false; 797 return false;
799 } 798 }
800 799
801 float TextAutosizer::superclusterMultiplier(Cluster* cluster) 800 float TextAutosizer::superclusterMultiplier(Cluster* cluster)
802 { 801 {
(...skipping 14 matching lines...) Expand all
817 816
818 return deepestBlockContainingAllText(root); 817 return deepestBlockContainingAllText(root);
819 } 818 }
820 819
821 const LayoutBlock* TextAutosizer::maxClusterWidthProvider(const Supercluster* su percluster, const LayoutBlock* currentRoot) const 820 const LayoutBlock* TextAutosizer::maxClusterWidthProvider(const Supercluster* su percluster, const LayoutBlock* currentRoot) const
822 { 821 {
823 const LayoutBlock* result = clusterWidthProvider(currentRoot); 822 const LayoutBlock* result = clusterWidthProvider(currentRoot);
824 float maxWidth = widthFromBlock(result); 823 float maxWidth = widthFromBlock(result);
825 824
826 const BlockSet* roots = supercluster->m_roots; 825 const BlockSet* roots = supercluster->m_roots;
827 for (BlockSet::iterator it = roots->begin(); it != roots->end(); ++it) { 826 for (const auto* root : *roots) {
828 const LayoutBlock* widthProvider = clusterWidthProvider(*it); 827 const LayoutBlock* widthProvider = clusterWidthProvider(root);
829 if (widthProvider->needsLayout()) 828 if (widthProvider->needsLayout())
830 continue; 829 continue;
831 float width = widthFromBlock(widthProvider); 830 float width = widthFromBlock(widthProvider);
832 if (width > maxWidth) { 831 if (width > maxWidth) {
833 maxWidth = width; 832 maxWidth = width;
834 result = widthProvider; 833 result = widthProvider;
835 } 834 }
836 } 835 }
837 RELEASE_ASSERT(result); 836 RELEASE_ASSERT(result);
838 return result; 837 return result;
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 } 1171 }
1173 return computedSize; 1172 return computedSize;
1174 } 1173 }
1175 1174
1176 DEFINE_TRACE(TextAutosizer) 1175 DEFINE_TRACE(TextAutosizer)
1177 { 1176 {
1178 visitor->trace(m_document); 1177 visitor->trace(m_document);
1179 } 1178 }
1180 1179
1181 } // namespace blink 1180 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/SubtreeLayoutScope.cpp ('k') | Source/core/layout/compositing/DeprecatedPaintLayerCompositor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698