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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutGrid.cpp

Issue 1709963002: [css-align] New CSS Value 'normal' for Self Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Getting back the FullScreen fix, missed during the rebase. Created 4 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 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 // arbitrary number of empty tracks between two non empty ones. 1783 // arbitrary number of empty tracks between two non empty ones.
1784 bool allRemainingTracksAreEmpty = remainingEmptyTracks == (lastLine - i); 1784 bool allRemainingTracksAreEmpty = remainingEmptyTracks == (lastLine - i);
1785 if (!allRemainingTracksAreEmpty || !isEmptyAutoRepeatTrack(direction , i)) 1785 if (!allRemainingTracksAreEmpty || !isEmptyAutoRepeatTrack(direction , i))
1786 tracks[i - 1] -= gap; 1786 tracks[i - 1] -= gap;
1787 } 1787 }
1788 } 1788 }
1789 1789
1790 return tracks; 1790 return tracks;
1791 } 1791 }
1792 1792
1793 static const StyleContentAlignmentData& normalValueBehavior() 1793 static const StyleContentAlignmentData& contentAlignmentNormalBehavior()
1794 { 1794 {
1795 static const StyleContentAlignmentData normalBehavior = {ContentPositionNorm al, ContentDistributionStretch}; 1795 static const StyleContentAlignmentData normalBehavior = {ContentPositionNorm al, ContentDistributionStretch};
1796 return normalBehavior; 1796 return normalBehavior;
1797 } 1797 }
1798 1798
1799 void LayoutGrid::applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection direction, GridSizingData& sizingData) 1799 void LayoutGrid::applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection direction, GridSizingData& sizingData)
1800 { 1800 {
1801 LayoutUnit& availableSpace = sizingData.freeSpaceForDirection(direction); 1801 LayoutUnit& availableSpace = sizingData.freeSpaceForDirection(direction);
1802 if (availableSpace <= 0 1802 if (availableSpace <= 0
1803 || (direction == ForColumns && styleRef().resolvedJustifyContentDistribu tion(normalValueBehavior()) != ContentDistributionStretch) 1803 || (direction == ForColumns && styleRef().resolvedJustifyContentDistribu tion(contentAlignmentNormalBehavior()) != ContentDistributionStretch)
1804 || (direction == ForRows && styleRef().resolvedAlignContentDistribution( normalValueBehavior()) != ContentDistributionStretch)) 1804 || (direction == ForRows && styleRef().resolvedAlignContentDistribution( contentAlignmentNormalBehavior()) != ContentDistributionStretch))
1805 return; 1805 return;
1806 1806
1807 // Spec defines auto-sized tracks as the ones with an 'auto' max-sizing func tion. 1807 // Spec defines auto-sized tracks as the ones with an 'auto' max-sizing func tion.
1808 Vector<GridTrack>& tracks = (direction == ForColumns) ? sizingData.columnTra cks : sizingData.rowTracks; 1808 Vector<GridTrack>& tracks = (direction == ForColumns) ? sizingData.columnTra cks : sizingData.rowTracks;
1809 Vector<unsigned> autoSizedTracksIndex; 1809 Vector<unsigned> autoSizedTracksIndex;
1810 for (unsigned i = 0; i < tracks.size(); ++i) { 1810 for (unsigned i = 0; i < tracks.size(); ++i) {
1811 const GridTrackSize& trackSize = gridTrackSize(direction, i); 1811 const GridTrackSize& trackSize = gridTrackSize(direction, i);
1812 if (trackSize.hasAutoMaxTrackBreadth()) 1812 if (trackSize.hasAutoMaxTrackBreadth())
1813 autoSizedTracksIndex.append(i); 1813 autoSizedTracksIndex.append(i);
1814 } 1814 }
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 } 2167 }
2168 2168
2169 LayoutUnit LayoutGrid::availableAlignmentSpaceForChildBeforeStretching(LayoutUni t gridAreaBreadthForChild, const LayoutBox& child) const 2169 LayoutUnit LayoutGrid::availableAlignmentSpaceForChildBeforeStretching(LayoutUni t gridAreaBreadthForChild, const LayoutBox& child) const
2170 { 2170 {
2171 // Because we want to avoid multiple layouts, stretching logic might be perf ormed before 2171 // Because we want to avoid multiple layouts, stretching logic might be perf ormed before
2172 // children are laid out, so we can't use the child cached values. Hence, we need to 2172 // children are laid out, so we can't use the child cached values. Hence, we need to
2173 // compute margins in order to determine the available height before stretch ing. 2173 // compute margins in order to determine the available height before stretch ing.
2174 return gridAreaBreadthForChild - (child.needsLayout() ? computeMarginLogical SizeForChild(BlockDirection, child) : marginLogicalHeightForChild(child)); 2174 return gridAreaBreadthForChild - (child.needsLayout() ? computeMarginLogical SizeForChild(BlockDirection, child) : marginLogicalHeightForChild(child));
2175 } 2175 }
2176 2176
2177 StyleSelfAlignmentData LayoutGrid::alignSelfForChild(const LayoutBox& child) con st
2178 {
2179 if (!child.isAnonymous())
2180 return child.styleRef().resolvedAlignSelf(selfAlignmentNormalBehavior()) ;
2181 // All the 'auto' values has been solved by the StyleAdjuster, but it's poss ible that
2182 // some grid items generate Anonymous boxes, which need to be solved during layout.
2183 return child.styleRef().resolvedAlignSelf(selfAlignmentNormalBehavior(), sty le());
2184 }
2185
2186 StyleSelfAlignmentData LayoutGrid::justifySelfForChild(const LayoutBox& child) c onst
2187 {
2188 if (!child.isAnonymous())
2189 return child.styleRef().resolvedJustifySelf(ItemPositionStretch);
2190 // All the 'auto' values has been solved by the StyleAdjuster, but it's poss ible that
2191 // some grid items generate Anonymous boxes, which need to be solved during layout.
2192 return child.styleRef().resolvedJustifySelf(selfAlignmentNormalBehavior(), s tyle());
2193 }
2194
2177 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La youtBox. 2195 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La youtBox.
2178 void LayoutGrid::applyStretchAlignmentToChildIfNeeded(LayoutBox& child) 2196 void LayoutGrid::applyStretchAlignmentToChildIfNeeded(LayoutBox& child)
2179 { 2197 {
2180 // We clear height override values because we will decide now whether it's a llowed or 2198 // We clear height override values because we will decide now whether it's a llowed or
2181 // not, evaluating the conditions which might have changed since the old val ues were set. 2199 // not, evaluating the conditions which might have changed since the old val ues were set.
2182 child.clearOverrideLogicalContentHeight(); 2200 child.clearOverrideLogicalContentHeight();
2183 2201
2184 auto& childStyle = child.styleRef(); 2202 auto& childStyle = child.styleRef();
2185 bool isHorizontalMode = isHorizontalWritingMode(); 2203 bool isHorizontalMode = isHorizontalWritingMode();
2186 bool childHasAutoSizeInColumnAxis = isHorizontalMode ? childStyle.height().i sAuto() : childStyle.width().isAuto(); 2204 bool childHasAutoSizeInColumnAxis = isHorizontalMode ? childStyle.height().i sAuto() : childStyle.width().isAuto();
2187 bool childHasAutoSizeInRowAxis = isHorizontalMode ? childStyle.width().isAut o() : childStyle.height().isAuto(); 2205 bool childHasAutoSizeInRowAxis = isHorizontalMode ? childStyle.width().isAut o() : childStyle.height().isAuto();
2188 bool allowedToStretchChildAlongColumnAxis = childHasAutoSizeInColumnAxis && !hasAutoMarginsInColumnAxis(child); 2206 bool allowedToStretchChildAlongColumnAxis = childHasAutoSizeInColumnAxis && !hasAutoMarginsInColumnAxis(child);
2189 bool allowedToStretchChildAlongRowAxis = childHasAutoSizeInRowAxis && !hasAu toMarginsInRowAxis(child); 2207 bool allowedToStretchChildAlongRowAxis = childHasAutoSizeInRowAxis && !hasAu toMarginsInRowAxis(child);
2190 bool stretchingAlongRowAxis = ComputedStyle::resolveJustification(styleRef() , childStyle, ItemPositionStretch) == ItemPositionStretch; 2208 bool stretchingAlongRowAxis = justifySelfForChild(child).position() == ItemP ositionStretch;
2191 bool stretchingAlongColumnAxis = ComputedStyle::resolveAlignment(styleRef(), childStyle, ItemPositionStretch) == ItemPositionStretch; 2209 bool stretchingAlongColumnAxis = alignSelfForChild(child).position() == Item PositionStretch;
2192 2210
2193 GridTrackSizingDirection childBlockDirection = flowAwareDirectionForChild(ch ild, ForRows); 2211 GridTrackSizingDirection childBlockDirection = flowAwareDirectionForChild(ch ild, ForRows);
2194 bool allowedToStretchChildBlockSize = childBlockDirection == ForRows ? allow edToStretchChildAlongColumnAxis && stretchingAlongColumnAxis : allowedToStretchC hildAlongRowAxis && stretchingAlongRowAxis; 2212 bool allowedToStretchChildBlockSize = childBlockDirection == ForRows ? allow edToStretchChildAlongColumnAxis && stretchingAlongColumnAxis : allowedToStretchC hildAlongRowAxis && stretchingAlongRowAxis;
2195 if (allowedToStretchChildBlockSize) { 2213 if (allowedToStretchChildBlockSize) {
2196 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBefor eStretching(overrideContainingBlockContentSizeForChild(child, childBlockDirectio n), child); 2214 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBefor eStretching(overrideContainingBlockContentSizeForChild(child, childBlockDirectio n), child);
2197 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(s tretchedLogicalHeight, LayoutUnit(-1)); 2215 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(s tretchedLogicalHeight, LayoutUnit(-1));
2198 child.setOverrideLogicalContentHeight(desiredLogicalHeight - child.borde rAndPaddingLogicalHeight()); 2216 child.setOverrideLogicalContentHeight(desiredLogicalHeight - child.borde rAndPaddingLogicalHeight());
2199 if (desiredLogicalHeight != child.logicalHeight()) { 2217 if (desiredLogicalHeight != child.logicalHeight()) {
2200 // TODO (lajava): Can avoid laying out here in some cases. See https ://webkit.org/b/87905. 2218 // TODO (lajava): Can avoid laying out here in some cases. See https ://webkit.org/b/87905.
2201 child.setLogicalHeight(LayoutUnit()); 2219 child.setLogicalHeight(LayoutUnit());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2260 } else if (marginAfter.isAuto()) { 2278 } else if (marginAfter.isAuto()) {
2261 child.setMarginAfter(availableAlignmentSpace, style()); 2279 child.setMarginAfter(availableAlignmentSpace, style());
2262 } 2280 }
2263 } 2281 }
2264 2282
2265 GridAxisPosition LayoutGrid::columnAxisPositionForChild(const LayoutBox& child) const 2283 GridAxisPosition LayoutGrid::columnAxisPositionForChild(const LayoutBox& child) const
2266 { 2284 {
2267 bool hasSameWritingMode = child.styleRef().getWritingMode() == styleRef().ge tWritingMode(); 2285 bool hasSameWritingMode = child.styleRef().getWritingMode() == styleRef().ge tWritingMode();
2268 bool childIsLTR = child.styleRef().isLeftToRightDirection(); 2286 bool childIsLTR = child.styleRef().isLeftToRightDirection();
2269 2287
2270 switch (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPo sitionStretch)) { 2288 switch (alignSelfForChild(child).position()) {
2271 case ItemPositionSelfStart: 2289 case ItemPositionSelfStart:
2272 // TODO (lajava): Should we implement this logic in a generic utility fu nction ? 2290 // TODO (lajava): Should we implement this logic in a generic utility fu nction ?
2273 // Aligns the alignment subject to be flush with the edge of the alignme nt container 2291 // Aligns the alignment subject to be flush with the edge of the alignme nt container
2274 // corresponding to the alignment subject's 'start' side in the column a xis. 2292 // corresponding to the alignment subject's 'start' side in the column a xis.
2275 if (isOrthogonalChild(child)) { 2293 if (isOrthogonalChild(child)) {
2276 // If orthogonal writing-modes, self-start will be based on the chil d's inline-axis 2294 // If orthogonal writing-modes, self-start will be based on the chil d's inline-axis
2277 // direction (inline-start), because it's the one parallel to the co lumn axis. 2295 // direction (inline-start), because it's the one parallel to the co lumn axis.
2278 if (styleRef().isFlippedBlocksWritingMode()) 2296 if (styleRef().isFlippedBlocksWritingMode())
2279 return childIsLTR ? GridAxisEnd : GridAxisStart; 2297 return childIsLTR ? GridAxisEnd : GridAxisStart;
2280 return childIsLTR ? GridAxisStart : GridAxisEnd; 2298 return childIsLTR ? GridAxisStart : GridAxisEnd;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 case ItemPositionEnd: 2331 case ItemPositionEnd:
2314 return GridAxisEnd; 2332 return GridAxisEnd;
2315 case ItemPositionStretch: 2333 case ItemPositionStretch:
2316 return GridAxisStart; 2334 return GridAxisStart;
2317 case ItemPositionBaseline: 2335 case ItemPositionBaseline:
2318 case ItemPositionLastBaseline: 2336 case ItemPositionLastBaseline:
2319 // FIXME: These two require implementing Baseline Alignment. For now, we always 'start' align the child. 2337 // FIXME: These two require implementing Baseline Alignment. For now, we always 'start' align the child.
2320 // crbug.com/234191 2338 // crbug.com/234191
2321 return GridAxisStart; 2339 return GridAxisStart;
2322 case ItemPositionAuto: 2340 case ItemPositionAuto:
2341 case ItemPositionNormal:
2323 break; 2342 break;
2324 } 2343 }
2325 2344
2326 ASSERT_NOT_REACHED(); 2345 ASSERT_NOT_REACHED();
2327 return GridAxisStart; 2346 return GridAxisStart;
2328 } 2347 }
2329 2348
2330 GridAxisPosition LayoutGrid::rowAxisPositionForChild(const LayoutBox& child) con st 2349 GridAxisPosition LayoutGrid::rowAxisPositionForChild(const LayoutBox& child) con st
2331 { 2350 {
2332 bool hasSameDirection = child.styleRef().direction() == styleRef().direction (); 2351 bool hasSameDirection = child.styleRef().direction() == styleRef().direction ();
2333 bool gridIsLTR = styleRef().isLeftToRightDirection(); 2352 bool gridIsLTR = styleRef().isLeftToRightDirection();
2334 2353
2335 switch (ComputedStyle::resolveJustification(styleRef(), child.styleRef(), It emPositionStretch)) { 2354 switch (justifySelfForChild(child).position()) {
2336 case ItemPositionSelfStart: 2355 case ItemPositionSelfStart:
2337 // TODO (lajava): Should we implement this logic in a generic utility fu nction ? 2356 // TODO (lajava): Should we implement this logic in a generic utility fu nction ?
2338 // Aligns the alignment subject to be flush with the edge of the alignme nt container 2357 // Aligns the alignment subject to be flush with the edge of the alignme nt container
2339 // corresponding to the alignment subject's 'start' side in the row axis . 2358 // corresponding to the alignment subject's 'start' side in the row axis .
2340 if (isOrthogonalChild(child)) { 2359 if (isOrthogonalChild(child)) {
2341 // If orthogonal writing-modes, self-start will be based on the chil d's block-axis 2360 // If orthogonal writing-modes, self-start will be based on the chil d's block-axis
2342 // direction, because it's the one parallel to the row axis. 2361 // direction, because it's the one parallel to the row axis.
2343 if (child.styleRef().isFlippedBlocksWritingMode()) 2362 if (child.styleRef().isFlippedBlocksWritingMode())
2344 return gridIsLTR ? GridAxisEnd : GridAxisStart; 2363 return gridIsLTR ? GridAxisEnd : GridAxisStart;
2345 return gridIsLTR ? GridAxisStart : GridAxisEnd; 2364 return gridIsLTR ? GridAxisStart : GridAxisEnd;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 case ItemPositionEnd: 2397 case ItemPositionEnd:
2379 return GridAxisEnd; 2398 return GridAxisEnd;
2380 case ItemPositionStretch: 2399 case ItemPositionStretch:
2381 return GridAxisStart; 2400 return GridAxisStart;
2382 case ItemPositionBaseline: 2401 case ItemPositionBaseline:
2383 case ItemPositionLastBaseline: 2402 case ItemPositionLastBaseline:
2384 // FIXME: These two require implementing Baseline Alignment. For now, we always 'start' align the child. 2403 // FIXME: These two require implementing Baseline Alignment. For now, we always 'start' align the child.
2385 // crbug.com/234191 2404 // crbug.com/234191
2386 return GridAxisStart; 2405 return GridAxisStart;
2387 case ItemPositionAuto: 2406 case ItemPositionAuto:
2407 case ItemPositionNormal:
2388 break; 2408 break;
2389 } 2409 }
2390 2410
2391 ASSERT_NOT_REACHED(); 2411 ASSERT_NOT_REACHED();
2392 return GridAxisStart; 2412 return GridAxisStart;
2393 } 2413 }
2394 2414
2395 LayoutUnit LayoutGrid::columnAxisOffsetForChild(const LayoutBox& child, GridSizi ngData& sizingData) const 2415 LayoutUnit LayoutGrid::columnAxisOffsetForChild(const LayoutBox& child, GridSizi ngData& sizingData) const
2396 { 2416 {
2397 const GridSpan& rowsSpan = cachedGridSpan(child, ForRows); 2417 const GridSpan& rowsSpan = cachedGridSpan(child, ForRows);
(...skipping 12 matching lines...) Expand all
2410 LayoutUnit endOfRow = m_rowPositions[childEndLine]; 2430 LayoutUnit endOfRow = m_rowPositions[childEndLine];
2411 // m_rowPositions include distribution offset (because of content alignm ent) and gutters 2431 // m_rowPositions include distribution offset (because of content alignm ent) and gutters
2412 // so we need to subtract them to get the actual end position for a give n row 2432 // so we need to subtract them to get the actual end position for a give n row
2413 // (this does not have to be done for the last track as there are no mor e m_columnPositions after it). 2433 // (this does not have to be done for the last track as there are no mor e m_columnPositions after it).
2414 LayoutUnit trackGap = gridGapForDirection(ForRows); 2434 LayoutUnit trackGap = gridGapForDirection(ForRows);
2415 if (childEndLine < m_rowPositions.size() - 1) { 2435 if (childEndLine < m_rowPositions.size() - 1) {
2416 endOfRow -= trackGap; 2436 endOfRow -= trackGap;
2417 endOfRow -= m_offsetBetweenRows; 2437 endOfRow -= m_offsetBetweenRows;
2418 } 2438 }
2419 LayoutUnit columnAxisChildSize = isOrthogonalChild(child) ? child.logica lWidth() + child.marginLogicalWidth() : child.logicalHeight() + child.marginLogi calHeight(); 2439 LayoutUnit columnAxisChildSize = isOrthogonalChild(child) ? child.logica lWidth() + child.marginLogicalWidth() : child.logicalHeight() + child.marginLogi calHeight();
2420 OverflowAlignment overflow = child.styleRef().resolvedAlignment(styleRef (), ItemPositionStretch).overflow(); 2440 OverflowAlignment overflow = alignSelfForChild(child).overflow();
2421 LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(over flow, endOfRow - startOfRow, columnAxisChildSize); 2441 LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(over flow, endOfRow - startOfRow, columnAxisChildSize);
2422 return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPos ition : offsetFromStartPosition / 2); 2442 return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPos ition : offsetFromStartPosition / 2);
2423 } 2443 }
2424 } 2444 }
2425 2445
2426 ASSERT_NOT_REACHED(); 2446 ASSERT_NOT_REACHED();
2427 return LayoutUnit(); 2447 return LayoutUnit();
2428 } 2448 }
2429 2449
2430 LayoutUnit LayoutGrid::rowAxisOffsetForChild(const LayoutBox& child, GridSizingD ata& sizingData) const 2450 LayoutUnit LayoutGrid::rowAxisOffsetForChild(const LayoutBox& child, GridSizingD ata& sizingData) const
(...skipping 14 matching lines...) Expand all
2445 LayoutUnit endOfColumn = m_columnPositions[childEndLine]; 2465 LayoutUnit endOfColumn = m_columnPositions[childEndLine];
2446 // m_columnPositions include distribution offset (because of content ali gnment) and gutters 2466 // m_columnPositions include distribution offset (because of content ali gnment) and gutters
2447 // so we need to subtract them to get the actual end position for a give n column 2467 // so we need to subtract them to get the actual end position for a give n column
2448 // (this does not have to be done for the last track as there are no mor e m_columnPositions after it). 2468 // (this does not have to be done for the last track as there are no mor e m_columnPositions after it).
2449 LayoutUnit trackGap = gridGapForDirection(ForColumns); 2469 LayoutUnit trackGap = gridGapForDirection(ForColumns);
2450 if (childEndLine < m_columnPositions.size() - 1) { 2470 if (childEndLine < m_columnPositions.size() - 1) {
2451 endOfColumn -= trackGap; 2471 endOfColumn -= trackGap;
2452 endOfColumn -= m_offsetBetweenColumns; 2472 endOfColumn -= m_offsetBetweenColumns;
2453 } 2473 }
2454 LayoutUnit rowAxisChildSize = isOrthogonalChild(child) ? child.logicalHe ight() + child.marginLogicalHeight() : child.logicalWidth() + child.marginLogica lWidth(); 2474 LayoutUnit rowAxisChildSize = isOrthogonalChild(child) ? child.logicalHe ight() + child.marginLogicalHeight() : child.logicalWidth() + child.marginLogica lWidth();
2455 LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(chil d.styleRef().justifySelfOverflowAlignment(), endOfColumn - startOfColumn, rowAxi sChildSize); 2475 OverflowAlignment overflow = justifySelfForChild(child).overflow();
2476 LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(over flow, endOfColumn - startOfColumn, rowAxisChildSize);
2456 return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPos ition : offsetFromStartPosition / 2); 2477 return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPos ition : offsetFromStartPosition / 2);
2457 } 2478 }
2458 } 2479 }
2459 2480
2460 ASSERT_NOT_REACHED(); 2481 ASSERT_NOT_REACHED();
2461 return LayoutUnit(); 2482 return LayoutUnit();
2462 } 2483 }
2463 2484
2464 ContentPosition static resolveContentDistributionFallback(ContentDistributionTyp e distribution) 2485 ContentPosition static resolveContentDistributionFallback(ContentDistributionTyp e distribution)
2465 { 2486 {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2507 return {}; 2528 return {};
2508 } 2529 }
2509 2530
2510 ASSERT_NOT_REACHED(); 2531 ASSERT_NOT_REACHED();
2511 return {}; 2532 return {};
2512 } 2533 }
2513 2534
2514 ContentAlignmentData LayoutGrid::computeContentPositionAndDistributionOffset(Gri dTrackSizingDirection direction, const LayoutUnit& availableFreeSpace, unsigned numberOfGridTracks) const 2535 ContentAlignmentData LayoutGrid::computeContentPositionAndDistributionOffset(Gri dTrackSizingDirection direction, const LayoutUnit& availableFreeSpace, unsigned numberOfGridTracks) const
2515 { 2536 {
2516 bool isRowAxis = direction == ForColumns; 2537 bool isRowAxis = direction == ForColumns;
2517 ContentPosition position = isRowAxis ? styleRef().resolvedJustifyContentPosi tion(normalValueBehavior()) : styleRef().resolvedAlignContentPosition(normalValu eBehavior()); 2538 ContentPosition position = isRowAxis ? styleRef().resolvedJustifyContentPosi tion(contentAlignmentNormalBehavior()) : styleRef().resolvedAlignContentPosition (contentAlignmentNormalBehavior());
2518 ContentDistributionType distribution = isRowAxis ? styleRef().resolvedJustif yContentDistribution(normalValueBehavior()) : styleRef().resolvedAlignContentDis tribution(normalValueBehavior()); 2539 ContentDistributionType distribution = isRowAxis ? styleRef().resolvedJustif yContentDistribution(contentAlignmentNormalBehavior()) : styleRef().resolvedAlig nContentDistribution(contentAlignmentNormalBehavior());
2519 // If <content-distribution> value can't be applied, 'position' will become the associated 2540 // If <content-distribution> value can't be applied, 'position' will become the associated
2520 // <content-position> fallback value. 2541 // <content-position> fallback value.
2521 ContentAlignmentData contentAlignment = contentDistributionOffset(availableF reeSpace, position, distribution, numberOfGridTracks); 2542 ContentAlignmentData contentAlignment = contentDistributionOffset(availableF reeSpace, position, distribution, numberOfGridTracks);
2522 if (contentAlignment.isValid()) 2543 if (contentAlignment.isValid())
2523 return contentAlignment; 2544 return contentAlignment;
2524 2545
2525 OverflowAlignment overflow = isRowAxis ? styleRef().justifyContentOverflowAl ignment() : styleRef().alignContentOverflowAlignment(); 2546 OverflowAlignment overflow = isRowAxis ? styleRef().justifyContentOverflowAl ignment() : styleRef().alignContentOverflowAlignment();
2526 if (availableFreeSpace <= 0 && overflow == OverflowAlignmentSafe) 2547 if (availableFreeSpace <= 0 && overflow == OverflowAlignmentSafe)
2527 return {LayoutUnit(), LayoutUnit()}; 2548 return {LayoutUnit(), LayoutUnit()};
2528 2549
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation; 2609 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation;
2589 } 2610 }
2590 2611
2591 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const 2612 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const
2592 { 2613 {
2593 if (!m_gridItemArea.isEmpty()) 2614 if (!m_gridItemArea.isEmpty())
2594 GridPainter(*this).paintChildren(paintInfo, paintOffset); 2615 GridPainter(*this).paintChildren(paintInfo, paintOffset);
2595 } 2616 }
2596 2617
2597 } // namespace blink 2618 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698