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

Unified Diff: Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 23472008: [CSS Grid Layout] Support calc() breadth track size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@103761-wk
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/CSSComputedStyleDeclaration.cpp
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index 37ef5411c1276260eda79819bbcf5ce26747665b..84e39f198a281646ba6f09f2c24d359dd0635bd0 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -997,7 +997,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForFilter(const RenderObj
return list.release();
}
-static PassRefPtr<CSSValue> valueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle* style, RenderView* renderView)
+static PassRefPtr<CSSValue> valueForGridTrackBreadth(const GridLength& trackBreadth, const RenderStyle* style, const LayoutUnit& maxSize, RenderView* renderView)
{
if (!trackBreadth.isLength())
Julien - ping for review 2013/09/24 19:09:16 There should be FIXME as this is wrong. We should
return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue::CSS_FR);
@@ -1007,18 +1007,20 @@ static PassRefPtr<CSSValue> valueForGridTrackBreadth(const GridLength& trackBrea
return cssValuePool().createIdentifierValue(CSSValueAuto);
if (trackBreadthLength.isViewportPercentage())
return zoomAdjustedPixelValue(valueForLength(trackBreadthLength, 0, renderView), style);
+ if (trackBreadthLength.isCalculated())
+ return zoomAdjustedPixelValue(valueForLength(trackBreadthLength, maxSize, renderView), style);
return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
}
-static PassRefPtr<CSSValue> valueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style, RenderView* renderView)
+static PassRefPtr<CSSValue> valueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style, const LayoutUnit& maxSize, RenderView* renderView)
{
switch (trackSize.type()) {
case LengthTrackSizing:
- return valueForGridTrackBreadth(trackSize.length(), style, renderView);
+ return valueForGridTrackBreadth(trackSize.length(), style, maxSize, renderView);
case MinMaxTrackSizing:
RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
- minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackBreadth(), style, renderView));
- minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackBreadth(), style, renderView));
+ minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.minTrackBreadth(), style, maxSize, renderView));
+ minMaxTrackBreadths->append(valueForGridTrackBreadth(trackSize.maxTrackBreadth(), style, maxSize, renderView));
return CSSFunctionValue::create("minmax(", minMaxTrackBreadths);
}
ASSERT_NOT_REACHED();
@@ -1032,7 +1034,7 @@ static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
list.append(cssValuePool().createValue(namedGridLines[j], CSSPrimitiveValue::CSS_STRING));
}
-static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& trackSizes, const OrderedNamedGridLines& orderedNamedGridLines, const RenderStyle* style, RenderView* renderView)
+static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& trackSizes, const OrderedNamedGridLines& orderedNamedGridLines, const RenderStyle* style, const LayoutUnit& maxSize, RenderView* renderView)
{
// Handle the 'none' case here.
if (!trackSizes.size()) {
@@ -1043,7 +1045,7 @@ static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& t
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
for (size_t i = 0; i < trackSizes.size(); ++i) {
addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
- list->append(valueForGridTrackSize(trackSizes[i], style, renderView));
+ list->append(valueForGridTrackSize(trackSizes[i], style, maxSize, renderView));
}
// Those are the trailing <string>* allowed in the syntax.
addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, trackSizes.size(), *list);
@@ -1561,6 +1563,8 @@ static bool isLayoutDependent(CSSPropertyID propertyID, PassRefPtr<RenderStyle>
// FIXME: Some of these cases could be narrowed down or optimized better.
switch (propertyID) {
case CSSPropertyBottom:
+ case CSSPropertyGridDefinitionColumns:
+ case CSSPropertyGridDefinitionRows:
case CSSPropertyHeight:
case CSSPropertyLeft:
case CSSPropertyRight:
@@ -2034,15 +2038,15 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
return list.release();
}
case CSSPropertyGridAutoColumns:
- return valueForGridTrackSize(style->gridAutoColumns(), style.get(), m_node->document().renderView());
+ return valueForGridTrackSize(style->gridAutoColumns(), style.get(), sizingBox(renderer).width(), m_node->document().renderView());
case CSSPropertyGridAutoFlow:
return cssValuePool().createValue(style->gridAutoFlow());
case CSSPropertyGridAutoRows:
- return valueForGridTrackSize(style->gridAutoRows(), style.get(), m_node->document().renderView());
+ return valueForGridTrackSize(style->gridAutoRows(), style.get(), sizingBox(renderer).height(), m_node->document().renderView());
case CSSPropertyGridDefinitionColumns:
- return valueForGridTrackList(style->gridDefinitionColumns(), style->orderedNamedGridColumnLines(), style.get(), m_node->document().renderView());
+ return valueForGridTrackList(style->gridDefinitionColumns(), style->orderedNamedGridColumnLines(), style.get(), sizingBox(renderer).width(), m_node->document().renderView());
case CSSPropertyGridDefinitionRows:
- return valueForGridTrackList(style->gridDefinitionRows(), style->orderedNamedGridRowLines(), style.get(), m_node->document().renderView());
+ return valueForGridTrackList(style->gridDefinitionRows(), style->orderedNamedGridRowLines(), style.get(), sizingBox(renderer).height(), m_node->document().renderView());
case CSSPropertyGridColumnStart:
return valueForGridPosition(style->gridColumnStart());

Powered by Google App Engine
This is Rietveld 408576698