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

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

Issue 1451883002: [css-grid] Store lines instead of tracks in GridResolvedPosition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comments Created 5 years, 1 month 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 for (const auto& item : gridAreaMap) { 52 for (const auto& item : gridAreaMap) {
53 const GridCoordinate& coordinate = item.value; 53 const GridCoordinate& coordinate = item.value;
54 if (row >= coordinate.rows.resolvedInitialPosition.toInt() && row <= coo rdinate.rows.resolvedFinalPosition.toInt()) 54 if (row >= coordinate.rows.resolvedInitialPosition.toInt() && row < coor dinate.rows.resolvedFinalPosition.toInt())
55 candidates.append(item.key); 55 candidates.append(item.key);
56 } 56 }
57 57
58 for (const auto& item : gridAreaMap) { 58 for (const auto& item : gridAreaMap) {
59 const GridCoordinate& coordinate = item.value; 59 const GridCoordinate& coordinate = item.value;
60 if (column >= coordinate.columns.resolvedInitialPosition.toInt() && colu mn <= coordinate.columns.resolvedFinalPosition.toInt() && candidates.contains(it em.key)) 60 if (column >= coordinate.columns.resolvedInitialPosition.toInt() && colu mn < coordinate.columns.resolvedFinalPosition.toInt() && candidates.contains(ite m.key))
61 return item.key; 61 return item.key;
62 } 62 }
63 63
64 return "."; 64 return ".";
65 } 65 }
66 66
67 String CSSGridTemplateAreasValue::customCSSText() const 67 String CSSGridTemplateAreasValue::customCSSText() const
68 { 68 {
69 StringBuilder builder; 69 StringBuilder builder;
70 for (size_t row = 0; row < m_rowCount; ++row) { 70 for (size_t row = 0; row < m_rowCount; ++row) {
71 builder.append('\"'); 71 builder.append('\"');
72 for (size_t column = 0; column < m_columnCount; ++column) { 72 for (size_t column = 0; column < m_columnCount; ++column) {
73 builder.append(stringForPosition(m_gridAreaMap, row, column)); 73 builder.append(stringForPosition(m_gridAreaMap, row, column));
74 if (column != m_columnCount - 1) 74 if (column != m_columnCount - 1)
75 builder.append(' '); 75 builder.append(' ');
76 } 76 }
77 builder.append('\"'); 77 builder.append('\"');
78 if (row != m_rowCount - 1) 78 if (row != m_rowCount - 1)
79 builder.append(' '); 79 builder.append(' ');
80 } 80 }
81 return builder.toString(); 81 return builder.toString();
82 } 82 }
83 83
84 bool CSSGridTemplateAreasValue::equals(const CSSGridTemplateAreasValue& other) c onst 84 bool CSSGridTemplateAreasValue::equals(const CSSGridTemplateAreasValue& other) c onst
85 { 85 {
86 return m_gridAreaMap == other.m_gridAreaMap && m_rowCount == other.m_rowCoun t && m_columnCount == other.m_columnCount; 86 return m_gridAreaMap == other.m_gridAreaMap && m_rowCount == other.m_rowCoun t && m_columnCount == other.m_columnCount;
87 } 87 }
88 88
89 } // namespace blink 89 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698