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

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

Issue 13992003: Add support for parsing <grid-line> that includes a 'span' (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed the change to match the specification Created 7 years, 8 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
« no previous file with comments | « Source/core/css/StyleResolver.h ('k') | Source/core/rendering/RenderGrid.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « Source/core/css/StyleResolver.h ('k') | Source/core/rendering/RenderGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698