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

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

Issue 166623002: [CSS Grid Layout] Introduce an explicit type for resolved grid positions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix compilation issue Created 6 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
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/parser/CSSPropertyParser.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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 NamedGridAreaMap::const_iterator end = gridAreaMap.end();
53 for (NamedGridAreaMap::const_iterator it = gridAreaMap.begin(); it != end; + +it) { 53 for (NamedGridAreaMap::const_iterator it = gridAreaMap.begin(); it != end; + +it) {
54 const GridCoordinate& coordinate = it->value; 54 const GridCoordinate& coordinate = it->value;
55 if (row >= coordinate.rows.initialPositionIndex && row <= coordinate.row s.finalPositionIndex) 55 if (row >= coordinate.rows.resolvedInitialPosition.toInt() && row <= coo rdinate.rows.resolvedFinalPosition.toInt())
56 candidates.append(it->key); 56 candidates.append(it->key);
57 } 57 }
58 58
59 end = gridAreaMap.end(); 59 end = gridAreaMap.end();
60 for (NamedGridAreaMap::const_iterator it = gridAreaMap.begin(); it != end; + +it) { 60 for (NamedGridAreaMap::const_iterator it = gridAreaMap.begin(); it != end; + +it) {
61 const GridCoordinate& coordinate = it->value; 61 const GridCoordinate& coordinate = it->value;
62 if (column >= coordinate.columns.initialPositionIndex && column <= coord inate.columns.finalPositionIndex && candidates.contains(it->key)) 62 if (column >= coordinate.columns.resolvedInitialPosition.toInt() && colu mn <= coordinate.columns.resolvedFinalPosition.toInt() && candidates.contains(it ->key))
63 return it->key; 63 return it->key;
64 } 64 }
65 65
66 return "."; 66 return ".";
67 } 67 }
68 68
69 String CSSGridTemplateAreasValue::customCSSText() const 69 String CSSGridTemplateAreasValue::customCSSText() const
70 { 70 {
71 StringBuilder builder; 71 StringBuilder builder;
72 for (size_t row = 0; row < m_rowCount; ++row) { 72 for (size_t row = 0; row < m_rowCount; ++row) {
73 builder.append('\"'); 73 builder.append('\"');
74 for (size_t column = 0; column < m_columnCount; ++column) { 74 for (size_t column = 0; column < m_columnCount; ++column) {
75 builder.append(stringForPosition(m_gridAreaMap, row, column)); 75 builder.append(stringForPosition(m_gridAreaMap, row, column));
76 if (column != m_columnCount - 1) 76 if (column != m_columnCount - 1)
77 builder.append(' '); 77 builder.append(' ');
78 } 78 }
79 builder.append('\"'); 79 builder.append('\"');
80 if (row != m_rowCount - 1) 80 if (row != m_rowCount - 1)
81 builder.append(' '); 81 builder.append(' ');
82 } 82 }
83 return builder.toString(); 83 return builder.toString();
84 } 84 }
85 85
86 } // namespace WebCore 86 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698