Index: Source/core/css/StyleResolver.cpp |
diff --git a/Source/core/css/StyleResolver.cpp b/Source/core/css/StyleResolver.cpp |
index 8eb283c39fb220c193d9fbf23f2b1bbe8b2af7ed..540df478ce5787c03be63b98d40a6fb7d0ce440b 100644 |
--- a/Source/core/css/StyleResolver.cpp |
+++ b/Source/core/css/StyleResolver.cpp |
@@ -1533,6 +1533,8 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty |
if (e && e->hasTagName(iframeTag) && style->display() == INLINE && static_cast<HTMLIFrameElement*>(e)->shouldDisplaySeamlessly()) |
style->setDisplay(INLINE_BLOCK); |
+ adjustGridItemPosition(style); |
+ |
#if ENABLE(SVG) |
if (e && e->isSVGElement()) { |
// Spec: http://www.w3.org/TR/SVG/masking.html#OverflowProperty |
@@ -1558,6 +1560,20 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty |
#endif |
} |
+void StyleResolver::adjustGridItemPosition(RenderStyle* style) const |
+{ |
+ // If opposing grid-placement properties both specify a grid span, they both compute to ‘auto’. |
+ if (style->gridItemStart().isSpan() && style->gridItemEnd().isSpan()) { |
+ style->setGridItemStart(GridPosition()); |
+ style->setGridItemEnd(GridPosition()); |
+ } |
+ |
+ if (style->gridItemBefore().isSpan() && style->gridItemAfter().isSpan()) { |
+ style->setGridItemBefore(GridPosition()); |
+ style->setGridItemAfter(GridPosition()); |
+ } |
+} |
+ |
bool StyleResolver::checkRegionStyle(Element* regionElement) |
{ |
// FIXME (BUG 72472): We don't add @-webkit-region rules of scoped style sheets for the moment, |
@@ -2102,16 +2118,30 @@ static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSiz |
static bool createGridPosition(CSSValue* value, GridPosition& position) |
{ |
- // For now, we only accept: <integer> | 'auto' |
- if (!value->isPrimitiveValue()) |
- return false; |
+ // For now, we only accept: 'auto' | <integer> | span && <integer>? |
+ if (value->isPrimitiveValue()) { |
+ CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); |
+ if (primitiveValue->getIdent() == CSSValueAuto) |
+ return true; |
- CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); |
- if (primitiveValue->getIdent() == CSSValueAuto) |
+ if (primitiveValue->getIdent() == CSSValueSpan) { |
+ // If the <integer> is omitted, it defaults to '1'. |
+ position.setSpanPosition(1); |
+ return true; |
+ } |
+ |
+ ASSERT(primitiveValue->isNumber()); |
+ position.setIntegerPosition(primitiveValue->getIntValue()); |
return true; |
+ } |
- ASSERT_WITH_SECURITY_IMPLICATION(primitiveValue->isNumber()); |
- position.setIntegerPosition(primitiveValue->getIntValue()); |
+ ASSERT_WITH_SECURITY_IMPLICATION(value->isValueList()); |
+ CSSValueList* values = static_cast<CSSValueList*>(value); |
+ ASSERT(values->length() == 2); |
+ ASSERT_WITH_SECURITY_IMPLICATION(values->itemWithoutBoundsCheck(1)->isPrimitiveValue()); |
+ CSSPrimitiveValue* numericValue = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(1)); |
+ ASSERT(numericValue->isNumber()); |
+ position.setSpanPosition(numericValue->getIntValue()); |
return true; |
} |