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

Side by Side Diff: sky/engine/core/rendering/RenderGrid.cpp

Issue 684383002: Delete a ton more dead vertical writing mode code. (Closed) Base URL: git@github.com:domokit/mojo.git@writingmode1
Patch Set: Created 6 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) 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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 child->setOverrideContainingBlockContentLogicalWidth(overrideContainingBlock ContentLogicalWidth); 613 child->setOverrideContainingBlockContentLogicalWidth(overrideContainingBlock ContentLogicalWidth);
614 // If |child| has a percentage logical height, we shouldn't let it override its intrinsic height, which is 614 // If |child| has a percentage logical height, we shouldn't let it override its intrinsic height, which is
615 // what we are interested in here. Thus we need to set the override logical height to -1 (no possible resolution). 615 // what we are interested in here. Thus we need to set the override logical height to -1 (no possible resolution).
616 child->setOverrideContainingBlockContentLogicalHeight(-1); 616 child->setOverrideContainingBlockContentLogicalHeight(-1);
617 child->layoutIfNeeded(); 617 child->layoutIfNeeded();
618 return child->logicalHeight() + child->marginLogicalHeight(); 618 return child->logicalHeight() + child->marginLogicalHeight();
619 } 619 }
620 620
621 LayoutUnit RenderGrid::minContentForChild(RenderBox* child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks) 621 LayoutUnit RenderGrid::minContentForChild(RenderBox* child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks)
622 { 622 {
623 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHorizo ntalWritingMode();
624 // FIXME: Properly support orthogonal writing mode.
625 if (hasOrthogonalWritingMode)
626 return 0;
627
628 if (direction == ForColumns) { 623 if (direction == ForColumns) {
629 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width. 624 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width.
630 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html 625 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
631 return child->minPreferredLogicalWidth() + marginIntrinsicLogicalWidthFo rChild(child); 626 return child->minPreferredLogicalWidth() + marginIntrinsicLogicalWidthFo rChild(child);
632 } 627 }
633 628
634 return logicalHeightForChild(child, columnTracks); 629 return logicalHeightForChild(child, columnTracks);
635 } 630 }
636 631
637 LayoutUnit RenderGrid::maxContentForChild(RenderBox* child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks) 632 LayoutUnit RenderGrid::maxContentForChild(RenderBox* child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks)
638 { 633 {
639 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHorizo ntalWritingMode();
640 // FIXME: Properly support orthogonal writing mode.
641 if (hasOrthogonalWritingMode)
642 return LayoutUnit();
643
644 if (direction == ForColumns) { 634 if (direction == ForColumns) {
645 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width. 635 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width.
646 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html 636 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
647 return child->maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthFo rChild(child); 637 return child->maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthFo rChild(child);
648 } 638 }
649 639
650 return logicalHeightForChild(child, columnTracks); 640 return logicalHeightForChild(child, columnTracks);
651 } 641 }
652 642
653 size_t RenderGrid::gridItemSpan(const RenderBox* child, GridTrackSizingDirection direction) 643 size_t RenderGrid::gridItemSpan(const RenderBox* child, GridTrackSizingDirection direction)
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 { 1153 {
1164 ItemPosition justify = childStyle->justifySelf(); 1154 ItemPosition justify = childStyle->justifySelf();
1165 if (justify == ItemPositionAuto) 1155 if (justify == ItemPositionAuto)
1166 justify = (parentStyle->justifyItems() == ItemPositionAuto) ? ItemPositi onStretch : parentStyle->justifyItems(); 1156 justify = (parentStyle->justifyItems() == ItemPositionAuto) ? ItemPositi onStretch : parentStyle->justifyItems();
1167 1157
1168 return justify; 1158 return justify;
1169 } 1159 }
1170 1160
1171 LayoutUnit RenderGrid::columnPositionForChild(const RenderBox* child) const 1161 LayoutUnit RenderGrid::columnPositionForChild(const RenderBox* child) const
1172 { 1162 {
1173 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHorizo ntalWritingMode();
1174
1175 switch (resolveJustification(style(), child->style())) { 1163 switch (resolveJustification(style(), child->style())) {
1176 case ItemPositionSelfStart: 1164 case ItemPositionSelfStart:
1177 // For orthogonal writing-modes, this computes to 'start'
1178 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet.
1179 if (hasOrthogonalWritingMode)
1180 return columnPositionAlignedWithGridContainerStart(child);
1181
1182 // self-start is based on the child's direction. That's why we need to c heck against the grid container's direction. 1165 // self-start is based on the child's direction. That's why we need to c heck against the grid container's direction.
1183 if (child->style()->direction() != style()->direction()) 1166 if (child->style()->direction() != style()->direction())
1184 return columnPositionAlignedWithGridContainerEnd(child); 1167 return columnPositionAlignedWithGridContainerEnd(child);
1185 1168
1186 return columnPositionAlignedWithGridContainerStart(child); 1169 return columnPositionAlignedWithGridContainerStart(child);
1187 case ItemPositionSelfEnd: 1170 case ItemPositionSelfEnd:
1188 // For orthogonal writing-modes, this computes to 'start'
1189 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet.
1190 if (hasOrthogonalWritingMode)
1191 return columnPositionAlignedWithGridContainerEnd(child);
1192
1193 // self-end is based on the child's direction. That's why we need to che ck against the grid container's direction. 1171 // self-end is based on the child's direction. That's why we need to che ck against the grid container's direction.
1194 if (child->style()->direction() != style()->direction()) 1172 if (child->style()->direction() != style()->direction())
1195 return columnPositionAlignedWithGridContainerStart(child); 1173 return columnPositionAlignedWithGridContainerStart(child);
1196 1174
1197 return columnPositionAlignedWithGridContainerEnd(child); 1175 return columnPositionAlignedWithGridContainerEnd(child);
1198 1176
1199 case ItemPositionFlexStart: 1177 case ItemPositionFlexStart:
1200 // Only used in flex layout, for other layout, it's equivalent to 'start '. 1178 // Only used in flex layout, for other layout, it's equivalent to 'start '.
1201 return columnPositionAlignedWithGridContainerStart(child); 1179 return columnPositionAlignedWithGridContainerStart(child);
1202 case ItemPositionFlexEnd: 1180 case ItemPositionFlexEnd:
1203 // Only used in flex layout, for other layout, it's equivalent to 'start '. 1181 // Only used in flex layout, for other layout, it's equivalent to 'start '.
1204 return columnPositionAlignedWithGridContainerEnd(child); 1182 return columnPositionAlignedWithGridContainerEnd(child);
1205 1183
1206 case ItemPositionLeft: 1184 case ItemPositionLeft:
1207 // If the property's axis is not parallel with the inline axis, this is equivalent to ‘start’.
1208 if (!isHorizontalWritingMode())
1209 return columnPositionAlignedWithGridContainerStart(child);
1210
1211 if (style()->isLeftToRightDirection()) 1185 if (style()->isLeftToRightDirection())
1212 return columnPositionAlignedWithGridContainerStart(child); 1186 return columnPositionAlignedWithGridContainerStart(child);
1213 1187
1214 return columnPositionAlignedWithGridContainerEnd(child); 1188 return columnPositionAlignedWithGridContainerEnd(child);
1215 case ItemPositionRight: 1189 case ItemPositionRight:
1216 // If the property's axis is not parallel with the inline axis, this is equivalent to ‘start’.
1217 if (!isHorizontalWritingMode())
1218 return columnPositionAlignedWithGridContainerStart(child);
1219
1220 if (style()->isLeftToRightDirection()) 1190 if (style()->isLeftToRightDirection())
1221 return columnPositionAlignedWithGridContainerEnd(child); 1191 return columnPositionAlignedWithGridContainerEnd(child);
1222 1192
1223 return columnPositionAlignedWithGridContainerStart(child); 1193 return columnPositionAlignedWithGridContainerStart(child);
1224 1194
1225 case ItemPositionCenter: 1195 case ItemPositionCenter:
1226 return centeredColumnPositionForChild(child); 1196 return centeredColumnPositionForChild(child);
1227 case ItemPositionStart: 1197 case ItemPositionStart:
1228 return columnPositionAlignedWithGridContainerStart(child); 1198 return columnPositionAlignedWithGridContainerStart(child);
1229 case ItemPositionEnd: 1199 case ItemPositionEnd:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 { 1254 {
1285 ItemPosition align = childStyle->alignSelf(); 1255 ItemPosition align = childStyle->alignSelf();
1286 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". 1256 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto".
1287 if (align == ItemPositionAuto) 1257 if (align == ItemPositionAuto)
1288 align = (parentStyle->alignItems() == ItemPositionAuto) ? ItemPositionSt retch : parentStyle->alignItems(); 1258 align = (parentStyle->alignItems() == ItemPositionAuto) ? ItemPositionSt retch : parentStyle->alignItems();
1289 return align; 1259 return align;
1290 } 1260 }
1291 1261
1292 LayoutUnit RenderGrid::rowPositionForChild(const RenderBox* child) const 1262 LayoutUnit RenderGrid::rowPositionForChild(const RenderBox* child) const
1293 { 1263 {
1294 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHorizo ntalWritingMode();
1295 ItemPosition alignSelf = resolveAlignment(style(), child->style()); 1264 ItemPosition alignSelf = resolveAlignment(style(), child->style());
1296 1265
1297 switch (alignSelf) { 1266 switch (alignSelf) {
1298 case ItemPositionSelfStart: 1267 case ItemPositionSelfStart:
1299 return startOfRowForChild(child); 1268 return startOfRowForChild(child);
1300 case ItemPositionSelfEnd: 1269 case ItemPositionSelfEnd:
1301 return endOfRowForChild(child); 1270 return endOfRowForChild(child);
1302 1271
1303 case ItemPositionLeft: 1272 case ItemPositionLeft:
1304 // orthogonal modes make property and inline axes to be parallel, but in any case 1273 // orthogonal modes make property and inline axes to be parallel, but in any case
1305 // this is always equivalent to 'Start'. 1274 // this is always equivalent to 'Start'.
1306 // 1275 //
1307 // self-align's axis is never parallel to the inline axis, except in ort hogonal 1276 // self-align's axis is never parallel to the inline axis, except in ort hogonal
1308 // writing-mode, so this is equivalent to 'Start’. 1277 // writing-mode, so this is equivalent to 'Start’.
1309 return startOfRowForChild(child); 1278 return startOfRowForChild(child);
1310 1279
1311 case ItemPositionRight: 1280 case ItemPositionRight:
1312 // orthogonal modes make property and inline axes to be parallel.
1313 // FIXME: grid track sizing and positioning does not support orthogonal modes yet.
1314 if (hasOrthogonalWritingMode)
1315 return endOfRowForChild(child);
1316
1317 // self-align's axis is never parallel to the inline axis, except in ort hogonal 1281 // self-align's axis is never parallel to the inline axis, except in ort hogonal
1318 // writing-mode, so this is equivalent to 'Start'. 1282 // writing-mode, so this is equivalent to 'Start'.
1319 return startOfRowForChild(child); 1283 return startOfRowForChild(child);
1320 1284
1321 case ItemPositionCenter: 1285 case ItemPositionCenter:
1322 return centeredRowPositionForChild(child); 1286 return centeredRowPositionForChild(child);
1323 // Only used in flex layout, for other layout, it's equivalent to 'Start '. 1287 // Only used in flex layout, for other layout, it's equivalent to 'Start '.
1324 case ItemPositionFlexStart: 1288 case ItemPositionFlexStart:
1325 case ItemPositionStart: 1289 case ItemPositionStart:
1326 return startOfRowForChild(child); 1290 return startOfRowForChild(child);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 if (isOutOfFlowPositioned()) 1388 if (isOutOfFlowPositioned())
1425 return "RenderGrid (positioned)"; 1389 return "RenderGrid (positioned)";
1426 if (isAnonymous()) 1390 if (isAnonymous())
1427 return "RenderGrid (generated)"; 1391 return "RenderGrid (generated)";
1428 if (isRelPositioned()) 1392 if (isRelPositioned())
1429 return "RenderGrid (relative positioned)"; 1393 return "RenderGrid (relative positioned)";
1430 return "RenderGrid"; 1394 return "RenderGrid";
1431 } 1395 }
1432 1396
1433 } // namespace blink 1397 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderGeometryMap.cpp ('k') | sky/engine/core/rendering/RenderInline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698