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

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

Issue 18532004: Implement 'grid-template' parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Same change, forgot to update css-properties-as-js-properties.html result Created 7 years, 5 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/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index f6ee7cad8652d8bb5295341884abe1f44aaeb390..67f8d827abb559eff2ec85ea08b1acbca359cd98 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -40,6 +40,7 @@
#include "core/css/CSSCursorImageValue.h"
#include "core/css/CSSDefaultStyleSheets.h"
#include "core/css/CSSFontSelector.h"
+#include "core/css/CSSGridTemplateValue.h"
#include "core/css/CSSImageSetValue.h"
#include "core/css/CSSKeyframeRule.h"
#include "core/css/CSSKeyframesRule.h"
@@ -2333,6 +2334,19 @@ static bool createGridPosition(CSSValue* value, GridPosition& position)
return true;
}
+static void createGridTemplate(CSSValue* value, NamedGridAreaMap& namedGridArea, size_t& rowCount, size_t& columnCount)
ojan 2013/07/29 23:03:28 I don't think this function adds value.
Julien - ping for review 2013/07/30 18:43:33 ACK!
+{
+ if (value->isPrimitiveValue()) {
+ ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
+ return;
+ }
+
+ CSSGridTemplateValue* gridTemplateValue = toCSSGridTemplateValue(value);
+ namedGridArea = gridTemplateValue->gridAreaMap();
+ rowCount = gridTemplateValue->rowCount();
+ columnCount = gridTemplateValue->columnCount();
esprehn 2013/07/29 23:27:36 This makes the code really confusing, can you just
+}
+
static bool hasVariableReference(CSSValue* value)
{
if (value->isPrimitiveValue()) {
@@ -3027,6 +3041,30 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
return;
}
+ case CSSPropertyGridTemplate: {
+ if (isInherit) {
+ m_state.style()->setNamedGridArea(m_state.parentStyle()->namedGridArea());
+ m_state.style()->setNamedGridAreaRowCount(m_state.parentStyle()->namedGridAreaRowCount());
+ m_state.style()->setNamedGridAreaColumnCount(m_state.parentStyle()->namedGridAreaColumnCount());
+ return;
+ }
+ if (isInitial) {
+ m_state.style()->setNamedGridArea(RenderStyle::initialNamedGridArea());
+ m_state.style()->setNamedGridAreaRowCount(RenderStyle::initialNamedGridAreaCount());
+ m_state.style()->setNamedGridAreaColumnCount(RenderStyle::initialNamedGridAreaCount());
+ return;
+ }
+
+ size_t rowCount;
+ size_t columnCount;
+ NamedGridAreaMap namedGridArea;
+ createGridTemplate(value, namedGridArea, rowCount, columnCount);
+ m_state.style()->setNamedGridArea(namedGridArea);
+ m_state.style()->setNamedGridAreaRowCount(rowCount);
+ m_state.style()->setNamedGridAreaColumnCount(columnCount);
+ return;
+ }
+
// These properties are aliased and DeprecatedStyleBuilder already applied the property on the prefixed version.
case CSSPropertyTransitionDelay:
case CSSPropertyTransitionDuration:

Powered by Google App Engine
This is Rietveld 408576698