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

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

Issue 1720063002: Spec-compliant shorthand parsing of foo-break-(after,before,inside). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/CSSCalculationValue.h" 10 #include "core/css/CSSCalculationValue.h"
(...skipping 4415 matching lines...) Expand 10 before | Expand all | Expand 10 after
4426 return false; 4426 return false;
4427 } 4427 }
4428 } 4428 }
4429 return false; 4429 return false;
4430 } 4430 }
4431 4431
4432 static inline CSSValueID mapFromPageBreakBetween(CSSValueID value) 4432 static inline CSSValueID mapFromPageBreakBetween(CSSValueID value)
4433 { 4433 {
4434 if (value == CSSValueAlways) 4434 if (value == CSSValueAlways)
4435 return CSSValuePage; 4435 return CSSValuePage;
4436 // TODO(mstensho): "avoid" should just return "avoid", not "avoid-page", acc ording to the spec. 4436 if (value == CSSValueAuto || value == CSSValueAvoid || value == CSSValueLeft || value == CSSValueRight)
4437 if (value == CSSValueAvoid)
4438 return CSSValueAvoidPage;
4439 if (value == CSSValueAuto || value == CSSValueLeft || value == CSSValueRight )
4440 return value; 4437 return value;
4441 return CSSValueInvalid; 4438 return CSSValueInvalid;
4442 } 4439 }
4443 4440
4444 static inline CSSValueID mapFromColumnBreakBetween(CSSValueID value) 4441 static inline CSSValueID mapFromColumnBreakBetween(CSSValueID value)
4445 { 4442 {
4446 if (value == CSSValueAlways) 4443 if (value == CSSValueAlways)
4447 return CSSValueColumn; 4444 return CSSValueColumn;
4448 // TODO(mstensho): "avoid" should just return "avoid", not "avoid-column". 4445 if (value == CSSValueAuto || value == CSSValueAvoid)
4449 if (value == CSSValueAvoid)
4450 return CSSValueAvoidColumn;
4451 // TODO(mstensho): column break properties shouldn't take 'left' and 'right' values (but
4452 // allowing it for now, since that's what we've always done).
4453 if (value == CSSValueAuto || value == CSSValueLeft || value == CSSValueRight )
4454 return value; 4446 return value;
4455 return CSSValueInvalid; 4447 return CSSValueInvalid;
4456 } 4448 }
4457 4449
4458 static inline CSSValueID mapFromPageBreakInside(CSSValueID value) 4450 static inline CSSValueID mapFromColumnOrPageBreakInside(CSSValueID value)
4459 { 4451 {
4460 // TODO(mstensho): "avoid" should just return "avoid", not "avoid-page", acc ording to the spec. 4452 if (value == CSSValueAuto || value == CSSValueAvoid)
4461 if (value == CSSValueAvoid)
4462 return CSSValueAvoidPage;
4463 if (value == CSSValueAuto)
4464 return value; 4453 return value;
4465 return CSSValueInvalid; 4454 return CSSValueInvalid;
4466 } 4455 }
4467
4468 static inline CSSValueID mapFromColumnBreakInside(CSSValueID value)
4469 {
4470 // TODO(mstensho): "avoid" should just return "avoid", not "avoid-column".
4471 if (value == CSSValueAvoid)
4472 return CSSValueAvoidColumn;
4473 if (value == CSSValueAuto)
4474 return value;
4475 return CSSValueInvalid;
4476 }
4477 4456
4478 static inline CSSPropertyID mapFromLegacyBreakProperty(CSSPropertyID property) 4457 static inline CSSPropertyID mapFromLegacyBreakProperty(CSSPropertyID property)
4479 { 4458 {
4480 if (property == CSSPropertyPageBreakAfter || property == CSSPropertyWebkitCo lumnBreakAfter) 4459 if (property == CSSPropertyPageBreakAfter || property == CSSPropertyWebkitCo lumnBreakAfter)
4481 return CSSPropertyBreakAfter; 4460 return CSSPropertyBreakAfter;
4482 if (property == CSSPropertyPageBreakBefore || property == CSSPropertyWebkitC olumnBreakBefore) 4461 if (property == CSSPropertyPageBreakBefore || property == CSSPropertyWebkitC olumnBreakBefore)
4483 return CSSPropertyBreakBefore; 4462 return CSSPropertyBreakBefore;
4484 ASSERT(property == CSSPropertyPageBreakInside || property == CSSPropertyWebk itColumnBreakInside); 4463 ASSERT(property == CSSPropertyPageBreakInside || property == CSSPropertyWebk itColumnBreakInside);
4485 return CSSPropertyBreakInside; 4464 return CSSPropertyBreakInside;
4486 } 4465 }
(...skipping 12 matching lines...) Expand all
4499 switch (property) { 4478 switch (property) {
4500 case CSSPropertyPageBreakAfter: 4479 case CSSPropertyPageBreakAfter:
4501 case CSSPropertyPageBreakBefore: 4480 case CSSPropertyPageBreakBefore:
4502 value = mapFromPageBreakBetween(value); 4481 value = mapFromPageBreakBetween(value);
4503 break; 4482 break;
4504 case CSSPropertyWebkitColumnBreakAfter: 4483 case CSSPropertyWebkitColumnBreakAfter:
4505 case CSSPropertyWebkitColumnBreakBefore: 4484 case CSSPropertyWebkitColumnBreakBefore:
4506 value = mapFromColumnBreakBetween(value); 4485 value = mapFromColumnBreakBetween(value);
4507 break; 4486 break;
4508 case CSSPropertyPageBreakInside: 4487 case CSSPropertyPageBreakInside:
4509 value = mapFromPageBreakInside(value);
4510 break;
4511 case CSSPropertyWebkitColumnBreakInside: 4488 case CSSPropertyWebkitColumnBreakInside:
4512 value = mapFromColumnBreakInside(value); 4489 value = mapFromColumnOrPageBreakInside(value);
4513 break; 4490 break;
4514 default: 4491 default:
4515 ASSERT_NOT_REACHED(); 4492 ASSERT_NOT_REACHED();
4516 } 4493 }
4517 if (value == CSSValueInvalid) 4494 if (value == CSSValueInvalid)
4518 return false; 4495 return false;
4519 4496
4520 CSSPropertyID genericBreakProperty = mapFromLegacyBreakProperty(property); 4497 CSSPropertyID genericBreakProperty = mapFromLegacyBreakProperty(property);
4521 addProperty(genericBreakProperty, cssValuePool().createIdentifierValue(value ), important); 4498 addProperty(genericBreakProperty, cssValuePool().createIdentifierValue(value ), important);
4522 return true; 4499 return true;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
4667 m_currentShorthand = oldShorthand; 4644 m_currentShorthand = oldShorthand;
4668 CSSParserValueList valueList(m_range); 4645 CSSParserValueList valueList(m_range);
4669 if (!valueList.size()) 4646 if (!valueList.size())
4670 return false; 4647 return false;
4671 m_valueList = &valueList; 4648 m_valueList = &valueList;
4672 return legacyParseShorthand(unresolvedProperty, important); 4649 return legacyParseShorthand(unresolvedProperty, important);
4673 } 4650 }
4674 } 4651 }
4675 4652
4676 } // namespace blink 4653 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698