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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 1807603002: Move the grid-column/grid-row shorthands into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/parser/CSSPropertyParser.h" 5 #include "core/css/parser/CSSPropertyParser.h"
6 6
7 #include "core/StylePropertyShorthand.h" 7 #include "core/StylePropertyShorthand.h"
8 #include "core/css/CSSBasicShapeValues.h" 8 #include "core/css/CSSBasicShapeValues.h"
9 #include "core/css/CSSBorderImage.h" 9 #include "core/css/CSSBorderImage.h"
10 #include "core/css/CSSContentDistributionValue.h" 10 #include "core/css/CSSContentDistributionValue.h"
(...skipping 4171 matching lines...) Expand 10 before | Expand all | Expand 10 after
4182 4182
4183 for (size_t i = 0; i < longhandCount; ++i) { 4183 for (size_t i = 0; i < longhandCount; ++i) {
4184 CSSPropertyID property = shorthand.properties()[i]; 4184 CSSPropertyID property = shorthand.properties()[i];
4185 if (property == CSSPropertyBackgroundSize && longhands[i] && m_context.u seLegacyBackgroundSizeShorthandBehavior()) 4185 if (property == CSSPropertyBackgroundSize && longhands[i] && m_context.u seLegacyBackgroundSizeShorthandBehavior())
4186 continue; 4186 continue;
4187 addProperty(property, longhands[i].release(), important, implicit); 4187 addProperty(property, longhands[i].release(), important, implicit);
4188 } 4188 }
4189 return true; 4189 return true;
4190 } 4190 }
4191 4191
4192 bool CSSPropertyParser::consumeGridItemPositionShorthand(CSSPropertyID shorthand Id, bool important)
4193 {
4194 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
4195 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId);
4196 ASSERT(shorthand.length() == 2);
4197 RefPtrWillBeRawPtr<CSSValue> startValue = consumeGridLine(m_range);
4198 if (!startValue)
4199 return false;
4200
4201 RefPtrWillBeRawPtr<CSSValue> endValue = nullptr;
4202 if (consumeSlashIncludingWhitespace(m_range)) {
4203 endValue = consumeGridLine(m_range);
4204 if (!endValue)
4205 return false;
4206 } else {
4207 endValue = startValue->isCustomIdentValue() ? startValue : cssValuePool( ).createIdentifierValue(CSSValueAuto);
4208 }
4209 if (!m_range.atEnd())
4210 return false;
4211 addProperty(shorthand.properties()[0], startValue, important);
4212 addProperty(shorthand.properties()[1], endValue, important);
4213 return true;
4214 }
4215
4192 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im portant) 4216 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im portant)
4193 { 4217 {
4194 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); 4218 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
4195 4219
4196 CSSPropertyID oldShorthand = m_currentShorthand; 4220 CSSPropertyID oldShorthand = m_currentShorthand;
4197 // TODO(rob.buis): Remove this when the legacy property parser is gone 4221 // TODO(rob.buis): Remove this when the legacy property parser is gone
4198 m_currentShorthand = property; 4222 m_currentShorthand = property;
4199 switch (property) { 4223 switch (property) {
4200 case CSSPropertyWebkitMarginCollapse: { 4224 case CSSPropertyWebkitMarginCollapse: {
4201 CSSValueID id = m_range.consumeIncludingWhitespace().id(); 4225 CSSValueID id = m_range.consumeIncludingWhitespace().id();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
4359 RefPtrWillBeRawPtr<CSSValue> rowGap = consumeLength(m_range, m_context.m ode(), ValueRangeNonNegative); 4383 RefPtrWillBeRawPtr<CSSValue> rowGap = consumeLength(m_range, m_context.m ode(), ValueRangeNonNegative);
4360 RefPtrWillBeRawPtr<CSSValue> columnGap = consumeLength(m_range, m_contex t.mode(), ValueRangeNonNegative); 4384 RefPtrWillBeRawPtr<CSSValue> columnGap = consumeLength(m_range, m_contex t.mode(), ValueRangeNonNegative);
4361 if (!rowGap || !m_range.atEnd()) 4385 if (!rowGap || !m_range.atEnd())
4362 return false; 4386 return false;
4363 if (!columnGap) 4387 if (!columnGap)
4364 columnGap = rowGap; 4388 columnGap = rowGap;
4365 addProperty(CSSPropertyGridRowGap, rowGap.release(), important); 4389 addProperty(CSSPropertyGridRowGap, rowGap.release(), important);
4366 addProperty(CSSPropertyGridColumnGap, columnGap.release(), important); 4390 addProperty(CSSPropertyGridColumnGap, columnGap.release(), important);
4367 return true; 4391 return true;
4368 } 4392 }
4393 case CSSPropertyGridColumn:
4394 case CSSPropertyGridRow:
4395 return consumeGridItemPositionShorthand(property, important);
4369 default: 4396 default:
4370 m_currentShorthand = oldShorthand; 4397 m_currentShorthand = oldShorthand;
4371 CSSParserValueList valueList(m_range); 4398 CSSParserValueList valueList(m_range);
4372 if (!valueList.size()) 4399 if (!valueList.size())
4373 return false; 4400 return false;
4374 m_valueList = &valueList; 4401 m_valueList = &valueList;
4375 return legacyParseShorthand(unresolvedProperty, important); 4402 return legacyParseShorthand(unresolvedProperty, important);
4376 } 4403 }
4377 } 4404 }
4378 4405
4379 } // namespace blink 4406 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698