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

Side by Side Diff: Source/core/rendering/RenderGrid.cpp

Issue 363133003: [CSS Grid Layout] Adapting align-self, align-items and justify-self to the last CSS 3 spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Resolve grid and flex cases during cascade, the rest will wait for layout. Created 6 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()]; 1212 LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.n ext().toInt()];
1213 1213
1214 // FIXME: This should account for the grid item's <overflow-position>. 1214 // FIXME: This should account for the grid item's <overflow-position>.
1215 return startOfRow + std::max<LayoutUnit>(0, endOfRow - startOfRow - child->l ogicalHeight()) / 2; 1215 return startOfRow + std::max<LayoutUnit>(0, endOfRow - startOfRow - child->l ogicalHeight()) / 2;
1216 } 1216 }
1217 1217
1218 // FIXME: We should move this logic to the StyleAdjuster or the StyleBuilder. 1218 // FIXME: We should move this logic to the StyleAdjuster or the StyleBuilder.
1219 static ItemPosition resolveAlignment(const RenderStyle* parentStyle, const Rende rStyle* childStyle) 1219 static ItemPosition resolveAlignment(const RenderStyle* parentStyle, const Rende rStyle* childStyle)
1220 { 1220 {
1221 ItemPosition align = childStyle->alignSelf(); 1221 ItemPosition align = childStyle->alignSelf();
1222 // The auto keyword computes to the computed value of align-items on the par ent. 1222 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto".
1223 if (align == ItemPositionAuto) 1223 if (align == ItemPositionAuto)
1224 align = (parentStyle->alignItems() == ItemPositionAuto) ? ItemPositionSt retch : parentStyle->alignItems(); 1224 align = (parentStyle->alignItems() == ItemPositionAuto) ? ItemPositionSt retch : parentStyle->alignItems();
1225 return align; 1225 return align;
1226 } 1226 }
1227 1227
1228 LayoutUnit RenderGrid::rowPositionForChild(const RenderBox* child) const 1228 LayoutUnit RenderGrid::rowPositionForChild(const RenderBox* child) const
1229 { 1229 {
1230 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHorizo ntalWritingMode(); 1230 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHorizo ntalWritingMode();
1231 ItemPosition alignSelf = resolveAlignment(style(), child->style()); 1231 ItemPosition alignSelf = resolveAlignment(style(), child->style());
1232 1232
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 if (isOutOfFlowPositioned()) 1378 if (isOutOfFlowPositioned())
1379 return "RenderGrid (positioned)"; 1379 return "RenderGrid (positioned)";
1380 if (isAnonymous()) 1380 if (isAnonymous())
1381 return "RenderGrid (generated)"; 1381 return "RenderGrid (generated)";
1382 if (isRelPositioned()) 1382 if (isRelPositioned())
1383 return "RenderGrid (relative positioned)"; 1383 return "RenderGrid (relative positioned)";
1384 return "RenderGrid"; 1384 return "RenderGrid";
1385 } 1385 }
1386 1386
1387 } // namespace blink 1387 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698