Index: Source/core/css/CSSComputedStyleDeclaration.cpp |
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp |
index 37ef5411c1276260eda79819bbcf5ce26747665b..fecba0c5580bffcf537bb7b1076145bd1d6c2154 100644 |
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp |
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp |
@@ -997,8 +997,9 @@ 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) |
{ |
+ // FIXME: according to the specs we must always return the used value http://crbug.com/297158 |
if (!trackBreadth.isLength()) |
return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue::CSS_FR); |
@@ -1007,18 +1008,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 +1035,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 +1046,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 +1564,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 +2039,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()); |