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 { | 42 { |
43 ASSERT(m_rowCount); | 43 ASSERT(m_rowCount); |
44 ASSERT(m_columnCount); | 44 ASSERT(m_columnCount); |
45 } | 45 } |
46 | 46 |
47 static String stringForPosition(const NamedGridAreaMap& gridAreaMap, size_t row,
size_t column) | 47 static String stringForPosition(const NamedGridAreaMap& gridAreaMap, size_t row,
size_t column) |
48 { | 48 { |
49 Vector<String> candidates; | 49 Vector<String> candidates; |
50 | 50 |
51 for (const auto& item : gridAreaMap) { | 51 for (const auto& item : gridAreaMap) { |
52 const GridCoordinate& coordinate = item.value; | 52 const GridArea& area = item.value; |
53 if (row >= coordinate.rows.resolvedInitialPosition() && row < coordinate
.rows.resolvedFinalPosition()) | 53 if (row >= area.rows.resolvedInitialPosition() && row < area.rows.resolv
edFinalPosition()) |
54 candidates.append(item.key); | 54 candidates.append(item.key); |
55 } | 55 } |
56 | 56 |
57 for (const auto& item : gridAreaMap) { | 57 for (const auto& item : gridAreaMap) { |
58 const GridCoordinate& coordinate = item.value; | 58 const GridArea& area = item.value; |
59 if (column >= coordinate.columns.resolvedInitialPosition() && column < c
oordinate.columns.resolvedFinalPosition() && candidates.contains(item.key)) | 59 if (column >= area.columns.resolvedInitialPosition() && column < area.co
lumns.resolvedFinalPosition() && candidates.contains(item.key)) |
60 return item.key; | 60 return item.key; |
61 } | 61 } |
62 | 62 |
63 return "."; | 63 return "."; |
64 } | 64 } |
65 | 65 |
66 String CSSGridTemplateAreasValue::customCSSText() const | 66 String CSSGridTemplateAreasValue::customCSSText() const |
67 { | 67 { |
68 StringBuilder builder; | 68 StringBuilder builder; |
69 for (size_t row = 0; row < m_rowCount; ++row) { | 69 for (size_t row = 0; row < m_rowCount; ++row) { |
70 builder.append('\"'); | 70 builder.append('\"'); |
71 for (size_t column = 0; column < m_columnCount; ++column) { | 71 for (size_t column = 0; column < m_columnCount; ++column) { |
72 builder.append(stringForPosition(m_gridAreaMap, row, column)); | 72 builder.append(stringForPosition(m_gridAreaMap, row, column)); |
73 if (column != m_columnCount - 1) | 73 if (column != m_columnCount - 1) |
74 builder.append(' '); | 74 builder.append(' '); |
75 } | 75 } |
76 builder.append('\"'); | 76 builder.append('\"'); |
77 if (row != m_rowCount - 1) | 77 if (row != m_rowCount - 1) |
78 builder.append(' '); | 78 builder.append(' '); |
79 } | 79 } |
80 return builder.toString(); | 80 return builder.toString(); |
81 } | 81 } |
82 | 82 |
83 bool CSSGridTemplateAreasValue::equals(const CSSGridTemplateAreasValue& other) c
onst | 83 bool CSSGridTemplateAreasValue::equals(const CSSGridTemplateAreasValue& other) c
onst |
84 { | 84 { |
85 return m_gridAreaMap == other.m_gridAreaMap && m_rowCount == other.m_rowCoun
t && m_columnCount == other.m_columnCount; | 85 return m_gridAreaMap == other.m_gridAreaMap && m_rowCount == other.m_rowCoun
t && m_columnCount == other.m_columnCount; |
86 } | 86 } |
87 | 87 |
88 } // namespace blink | 88 } // namespace blink |
OLD | NEW |