OLD | NEW |
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 Loading... |
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 |
OLD | NEW |