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

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

Issue 1309513008: [css-grid] Implement grid gutters (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed two tests which were not testing gutters code Created 5 years, 3 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) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * Copyright (C) 2015 Google Inc. All rights reserved. 7 * Copyright (C) 2015 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 } 602 }
603 603
604 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 604 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
605 size_t insertionIndex; 605 size_t insertionIndex;
606 if (isLayoutGrid) { 606 if (isLayoutGrid) {
607 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi tions(); 607 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi tions();
608 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro m that, the grid container can generate implicit grid tracks, 608 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro m that, the grid container can generate implicit grid tracks,
609 // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid. 609 // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid.
610 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); 610 ASSERT(trackPositions.size() - 1 >= trackSizes.size());
611 611
612 for (size_t i = 0; i < trackPositions.size() - 1; ++i) { 612 size_t i;
613 LayoutUnit gutterSize = toLayoutGrid(layoutObject)->guttersSize(directio n, 2);
614 for (i = 0; i < trackPositions.size() - 2; ++i) {
613 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); 615 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
614 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos itions[i], style)); 616 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos itions[i] - gutterSize, style));
615 } 617 }
618 // Last track line does not have any gutter.
619 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
620 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositio ns[i], style));
616 insertionIndex = trackPositions.size() - 1; 621 insertionIndex = trackPositions.size() - 1;
617 } else { 622 } else {
618 for (size_t i = 0; i < trackSizes.size(); ++i) { 623 for (size_t i = 0; i < trackSizes.size(); ++i) {
619 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); 624 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
620 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); 625 list->append(specifiedValueForGridTrackSize(trackSizes[i], style));
621 } 626 }
622 insertionIndex = trackSizes.size(); 627 insertionIndex = trackSizes.size();
623 } 628 }
624 // Those are the trailing <string>* allowed in the syntax. 629 // Those are the trailing <string>* allowed in the syntax.
625 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li st); 630 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li st);
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 return valuesForGridShorthand(gridTemplateShorthand(), style, layoutObje ct, styledNode, allowVisitedStyle); 1730 return valuesForGridShorthand(gridTemplateShorthand(), style, layoutObje ct, styledNode, allowVisitedStyle);
1726 case CSSPropertyGrid: 1731 case CSSPropertyGrid:
1727 return valuesForGridShorthand(gridShorthand(), style, layoutObject, styl edNode, allowVisitedStyle); 1732 return valuesForGridShorthand(gridShorthand(), style, layoutObject, styl edNode, allowVisitedStyle);
1728 case CSSPropertyGridTemplateAreas: 1733 case CSSPropertyGridTemplateAreas:
1729 if (!style.namedGridAreaRowCount()) { 1734 if (!style.namedGridAreaRowCount()) {
1730 ASSERT(!style.namedGridAreaColumnCount()); 1735 ASSERT(!style.namedGridAreaColumnCount());
1731 return cssValuePool().createIdentifierValue(CSSValueNone); 1736 return cssValuePool().createIdentifierValue(CSSValueNone);
1732 } 1737 }
1733 1738
1734 return CSSGridTemplateAreasValue::create(style.namedGridArea(), style.na medGridAreaRowCount(), style.namedGridAreaColumnCount()); 1739 return CSSGridTemplateAreasValue::create(style.namedGridArea(), style.na medGridAreaRowCount(), style.namedGridAreaColumnCount());
1740 case CSSPropertyGridColumnGap:
1741 return zoomAdjustedPixelValueForLength(style.gridColumnGap(), style);
1742 case CSSPropertyGridRowGap:
1743 return zoomAdjustedPixelValueForLength(style.gridRowGap(), style);
1744 case CSSPropertyGridGap:
1745 return valuesForShorthandProperty(gridGapShorthand(), style, layoutObjec t, styledNode, allowVisitedStyle);
1735 1746
1736 case CSSPropertyHeight: 1747 case CSSPropertyHeight:
1737 if (layoutObject) { 1748 if (layoutObject) {
1738 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-pr operty, 1749 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-pr operty,
1739 // the "height" property does not apply for non-replaced inline elem ents. 1750 // the "height" property does not apply for non-replaced inline elem ents.
1740 if (!layoutObject->isReplaced() && layoutObject->isInline()) 1751 if (!layoutObject->isReplaced() && layoutObject->isInline())
1741 return cssValuePool().createIdentifierValue(CSSValueAuto); 1752 return cssValuePool().createIdentifierValue(CSSValueAuto);
1742 return zoomAdjustedPixelValue(sizingBox(layoutObject).height(), styl e); 1753 return zoomAdjustedPixelValue(sizingBox(layoutObject).height(), styl e);
1743 } 1754 }
1744 return zoomAdjustedPixelValueForLength(style.height(), style); 1755 return zoomAdjustedPixelValueForLength(style.height(), style);
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 case CSSPropertyAll: 2720 case CSSPropertyAll:
2710 return nullptr; 2721 return nullptr;
2711 default: 2722 default:
2712 break; 2723 break;
2713 } 2724 }
2714 ASSERT_NOT_REACHED(); 2725 ASSERT_NOT_REACHED();
2715 return nullptr; 2726 return nullptr;
2716 } 2727 }
2717 2728
2718 } 2729 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698