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

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: Patch for landing v3 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 } 612 }
613 613
614 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 614 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
615 size_t insertionIndex; 615 size_t insertionIndex;
616 if (isLayoutGrid) { 616 if (isLayoutGrid) {
617 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi tions(); 617 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL ayoutGrid(layoutObject)->columnPositions() : toLayoutGrid(layoutObject)->rowPosi tions();
618 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro m that, the grid container can generate implicit grid tracks, 618 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro m that, the grid container can generate implicit grid tracks,
619 // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid. 619 // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid.
620 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); 620 ASSERT(trackPositions.size() - 1 >= trackSizes.size());
621 621
622 for (size_t i = 0; i < trackPositions.size() - 1; ++i) { 622 size_t i;
623 LayoutUnit gutterSize = toLayoutGrid(layoutObject)->guttersSize(directio n, 2);
624 for (i = 0; i < trackPositions.size() - 2; ++i) {
623 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); 625 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
624 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos itions[i], style)); 626 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos itions[i] - gutterSize, style));
625 } 627 }
628 // Last track line does not have any gutter.
629 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
630 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositio ns[i], style));
626 insertionIndex = trackPositions.size() - 1; 631 insertionIndex = trackPositions.size() - 1;
627 } else { 632 } else {
628 for (size_t i = 0; i < trackSizes.size(); ++i) { 633 for (size_t i = 0; i < trackSizes.size(); ++i) {
629 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); 634 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
630 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); 635 list->append(specifiedValueForGridTrackSize(trackSizes[i], style));
631 } 636 }
632 insertionIndex = trackSizes.size(); 637 insertionIndex = trackSizes.size();
633 } 638 }
634 // Those are the trailing <string>* allowed in the syntax. 639 // Those are the trailing <string>* allowed in the syntax.
635 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li st); 640 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, insertionIndex, *li st);
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 return valuesForGridShorthand(gridTemplateShorthand(), style, layoutObje ct, styledNode, allowVisitedStyle); 1716 return valuesForGridShorthand(gridTemplateShorthand(), style, layoutObje ct, styledNode, allowVisitedStyle);
1712 case CSSPropertyGrid: 1717 case CSSPropertyGrid:
1713 return valuesForGridShorthand(gridShorthand(), style, layoutObject, styl edNode, allowVisitedStyle); 1718 return valuesForGridShorthand(gridShorthand(), style, layoutObject, styl edNode, allowVisitedStyle);
1714 case CSSPropertyGridTemplateAreas: 1719 case CSSPropertyGridTemplateAreas:
1715 if (!style.namedGridAreaRowCount()) { 1720 if (!style.namedGridAreaRowCount()) {
1716 ASSERT(!style.namedGridAreaColumnCount()); 1721 ASSERT(!style.namedGridAreaColumnCount());
1717 return cssValuePool().createIdentifierValue(CSSValueNone); 1722 return cssValuePool().createIdentifierValue(CSSValueNone);
1718 } 1723 }
1719 1724
1720 return CSSGridTemplateAreasValue::create(style.namedGridArea(), style.na medGridAreaRowCount(), style.namedGridAreaColumnCount()); 1725 return CSSGridTemplateAreasValue::create(style.namedGridArea(), style.na medGridAreaRowCount(), style.namedGridAreaColumnCount());
1726 case CSSPropertyGridColumnGap:
1727 return zoomAdjustedPixelValueForLength(style.gridColumnGap(), style);
1728 case CSSPropertyGridRowGap:
1729 return zoomAdjustedPixelValueForLength(style.gridRowGap(), style);
1730 case CSSPropertyGridGap:
1731 return valuesForShorthandProperty(gridGapShorthand(), style, layoutObjec t, styledNode, allowVisitedStyle);
1721 1732
1722 case CSSPropertyHeight: 1733 case CSSPropertyHeight:
1723 if (layoutObject) { 1734 if (layoutObject) {
1724 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-pr operty, 1735 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-pr operty,
1725 // the "height" property does not apply for non-replaced inline elem ents. 1736 // the "height" property does not apply for non-replaced inline elem ents.
1726 if (!layoutObject->isReplaced() && layoutObject->isInline()) 1737 if (!layoutObject->isReplaced() && layoutObject->isInline())
1727 return cssValuePool().createIdentifierValue(CSSValueAuto); 1738 return cssValuePool().createIdentifierValue(CSSValueAuto);
1728 return zoomAdjustedPixelValue(sizingBox(layoutObject).height(), styl e); 1739 return zoomAdjustedPixelValue(sizingBox(layoutObject).height(), styl e);
1729 } 1740 }
1730 return zoomAdjustedPixelValueForLength(style.height(), style); 1741 return zoomAdjustedPixelValueForLength(style.height(), style);
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 case CSSPropertyAll: 2705 case CSSPropertyAll:
2695 return nullptr; 2706 return nullptr;
2696 default: 2707 default:
2697 break; 2708 break;
2698 } 2709 }
2699 ASSERT_NOT_REACHED(); 2710 ASSERT_NOT_REACHED();
2700 return nullptr; 2711 return nullptr;
2701 } 2712 }
2702 2713
2703 } 2714 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698