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

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

Issue 645743003: Use C++11 range-based loop for core/css (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: better variable names Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSCrossfadeValue.cpp ('k') | Source/core/css/CSSSegmentedFontFace.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 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 , m_columnCount(columnCount) 42 , m_columnCount(columnCount)
43 { 43 {
44 ASSERT(m_rowCount); 44 ASSERT(m_rowCount);
45 ASSERT(m_columnCount); 45 ASSERT(m_columnCount);
46 } 46 }
47 47
48 static String stringForPosition(const NamedGridAreaMap& gridAreaMap, size_t row, size_t column) 48 static String stringForPosition(const NamedGridAreaMap& gridAreaMap, size_t row, size_t column)
49 { 49 {
50 Vector<String> candidates; 50 Vector<String> candidates;
51 51
52 NamedGridAreaMap::const_iterator end = gridAreaMap.end(); 52 for (const auto& item : gridAreaMap) {
53 for (NamedGridAreaMap::const_iterator it = gridAreaMap.begin(); it != end; + +it) { 53 const GridCoordinate& coordinate = item.value;
54 const GridCoordinate& coordinate = it->value;
55 if (row >= coordinate.rows.resolvedInitialPosition.toInt() && row <= coo rdinate.rows.resolvedFinalPosition.toInt()) 54 if (row >= coordinate.rows.resolvedInitialPosition.toInt() && row <= coo rdinate.rows.resolvedFinalPosition.toInt())
56 candidates.append(it->key); 55 candidates.append(item.key);
57 } 56 }
58 57
59 end = gridAreaMap.end(); 58 for (const auto& item : gridAreaMap) {
60 for (NamedGridAreaMap::const_iterator it = gridAreaMap.begin(); it != end; + +it) { 59 const GridCoordinate& coordinate = item.value;
61 const GridCoordinate& coordinate = it->value; 60 if (column >= coordinate.columns.resolvedInitialPosition.toInt() && colu mn <= coordinate.columns.resolvedFinalPosition.toInt() && candidates.contains(it em.key))
62 if (column >= coordinate.columns.resolvedInitialPosition.toInt() && colu mn <= coordinate.columns.resolvedFinalPosition.toInt() && candidates.contains(it ->key)) 61 return item.key;
63 return it->key;
64 } 62 }
65 63
66 return "."; 64 return ".";
67 } 65 }
68 66
69 String CSSGridTemplateAreasValue::customCSSText() const 67 String CSSGridTemplateAreasValue::customCSSText() const
70 { 68 {
71 StringBuilder builder; 69 StringBuilder builder;
72 for (size_t row = 0; row < m_rowCount; ++row) { 70 for (size_t row = 0; row < m_rowCount; ++row) {
73 builder.append('\"'); 71 builder.append('\"');
74 for (size_t column = 0; column < m_columnCount; ++column) { 72 for (size_t column = 0; column < m_columnCount; ++column) {
75 builder.append(stringForPosition(m_gridAreaMap, row, column)); 73 builder.append(stringForPosition(m_gridAreaMap, row, column));
76 if (column != m_columnCount - 1) 74 if (column != m_columnCount - 1)
77 builder.append(' '); 75 builder.append(' ');
78 } 76 }
79 builder.append('\"'); 77 builder.append('\"');
80 if (row != m_rowCount - 1) 78 if (row != m_rowCount - 1)
81 builder.append(' '); 79 builder.append(' ');
82 } 80 }
83 return builder.toString(); 81 return builder.toString();
84 } 82 }
85 83
86 } // namespace blink 84 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/CSSCrossfadeValue.cpp ('k') | Source/core/css/CSSSegmentedFontFace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698