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

Side by Side Diff: third_party/WebKit/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: Rebased patch for landing Created 5 years, 2 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 } 615 }
616 616
617 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 617 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
618 size_t insertionIndex; 618 size_t insertionIndex;
619 if (isLayoutGrid) { 619 if (isLayoutGrid) {
620 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi tions(); 620 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi tions();
621 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro m that, the grid container can generate implicit grid tracks, 621 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro m that, the grid container can generate implicit grid tracks,
622 // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid. 622 // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid.
623 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); 623 ASSERT(trackPositions.size() - 1 >= trackSizes.size());
624 624
625 for (size_t i = 0; i < trackPositions.size() - 1; ++i) { 625 size_t i;
626 LayoutUnit gutterSize = toLayoutGrid(layoutObject)->guttersSize(directio n, 2);
627 for (i = 0; i < trackPositions.size() - 2; ++i) {
626 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); 628 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
627 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos itions[i], style)); 629 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos itions[i] - gutterSize, style));
628 } 630 }
631 // Last track line does not have any gutter.
632 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
633 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositio ns[i], style));
629 insertionIndex = trackPositions.size() - 1; 634 insertionIndex = trackPositions.size() - 1;
630 } else { 635 } else {
631 for (size_t i = 0; i < trackSizes.size(); ++i) { 636 for (size_t i = 0; i < trackSizes.size(); ++i) {
632 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); 637 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
633 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); 638 list->append(specifiedValueForGridTrackSize(trackSizes[i], style));
634 } 639 }
635 insertionIndex = trackSizes.size(); 640 insertionIndex = trackSizes.size();
636 } 641 }
637 // Those are the trailing <string>* allowed in the syntax. 642 // Those are the trailing <string>* allowed in the syntax.
638 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li st); 643 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li st);
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 return valuesForGridShorthand(gridTemplateShorthand(), style, layoutObje ct, styledNode, allowVisitedStyle); 1719 return valuesForGridShorthand(gridTemplateShorthand(), style, layoutObje ct, styledNode, allowVisitedStyle);
1715 case CSSPropertyGrid: 1720 case CSSPropertyGrid:
1716 return valuesForGridShorthand(gridShorthand(), style, layoutObject, styl edNode, allowVisitedStyle); 1721 return valuesForGridShorthand(gridShorthand(), style, layoutObject, styl edNode, allowVisitedStyle);
1717 case CSSPropertyGridTemplateAreas: 1722 case CSSPropertyGridTemplateAreas:
1718 if (!style.namedGridAreaRowCount()) { 1723 if (!style.namedGridAreaRowCount()) {
1719 ASSERT(!style.namedGridAreaColumnCount()); 1724 ASSERT(!style.namedGridAreaColumnCount());
1720 return cssValuePool().createIdentifierValue(CSSValueNone); 1725 return cssValuePool().createIdentifierValue(CSSValueNone);
1721 } 1726 }
1722 1727
1723 return CSSGridTemplateAreasValue::create(style.namedGridArea(), style.na medGridAreaRowCount(), style.namedGridAreaColumnCount()); 1728 return CSSGridTemplateAreasValue::create(style.namedGridArea(), style.na medGridAreaRowCount(), style.namedGridAreaColumnCount());
1729 case CSSPropertyGridColumnGap:
1730 return zoomAdjustedPixelValueForLength(style.gridColumnGap(), style);
1731 case CSSPropertyGridRowGap:
1732 return zoomAdjustedPixelValueForLength(style.gridRowGap(), style);
1733 case CSSPropertyGridGap:
1734 return valuesForShorthandProperty(gridGapShorthand(), style, layoutObjec t, styledNode, allowVisitedStyle);
1724 1735
1725 case CSSPropertyHeight: 1736 case CSSPropertyHeight:
1726 if (layoutObject) { 1737 if (layoutObject) {
1727 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-pr operty, 1738 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-pr operty,
1728 // the "height" property does not apply for non-replaced inline elem ents. 1739 // the "height" property does not apply for non-replaced inline elem ents.
1729 if (!layoutObject->isReplaced() && layoutObject->isInline()) 1740 if (!layoutObject->isReplaced() && layoutObject->isInline())
1730 return cssValuePool().createIdentifierValue(CSSValueAuto); 1741 return cssValuePool().createIdentifierValue(CSSValueAuto);
1731 return zoomAdjustedPixelValue(sizingBox(layoutObject).height(), styl e); 1742 return zoomAdjustedPixelValue(sizingBox(layoutObject).height(), styl e);
1732 } 1743 }
1733 return zoomAdjustedPixelValueForLength(style.height(), style); 1744 return zoomAdjustedPixelValueForLength(style.height(), style);
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 case CSSPropertyAll: 2714 case CSSPropertyAll:
2704 return nullptr; 2715 return nullptr;
2705 default: 2716 default:
2706 break; 2717 break;
2707 } 2718 }
2708 ASSERT_NOT_REACHED(); 2719 ASSERT_NOT_REACHED();
2709 return nullptr; 2720 return nullptr;
2710 } 2721 }
2711 2722
2712 } 2723 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSProperties.in ('k') | third_party/WebKit/Source/core/css/StylePropertySerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698