| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/css/parser/CSSPropertyParser.h" | 6 #include "core/css/parser/CSSPropertyParser.h" |
| 7 | 7 |
| 8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
| 9 #include "core/css/CSSCalculationValue.h" | 9 #include "core/css/CSSCalculationValue.h" |
| 10 #include "core/css/CSSCustomIdentValue.h" | 10 #include "core/css/CSSCustomIdentValue.h" |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 | 706 |
| 707 if (!orientation && !pageSize) | 707 if (!orientation && !pageSize) |
| 708 return nullptr; | 708 return nullptr; |
| 709 if (pageSize) | 709 if (pageSize) |
| 710 result->append(pageSize.release()); | 710 result->append(pageSize.release()); |
| 711 if (orientation) | 711 if (orientation) |
| 712 result->append(orientation.release()); | 712 result->append(orientation.release()); |
| 713 return result.release(); | 713 return result.release(); |
| 714 } | 714 } |
| 715 | 715 |
| 716 static PassRefPtrWillBeRawPtr<CSSValue> consumeTextIndent(CSSParserTokenRange& r
ange, CSSParserMode cssParserMode) |
| 717 { |
| 718 // [ <length> | <percentage> ] && hanging? && each-line? |
| 719 // Keywords only allowed when css3Text is enabled. |
| 720 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
| 721 |
| 722 bool hasLengthOrPercentage = false; |
| 723 bool hasEachLine = false; |
| 724 bool hasHanging = false; |
| 725 |
| 726 do { |
| 727 if (!hasLengthOrPercentage) { |
| 728 if (RefPtrWillBeRawPtr<CSSValue> textIndent = consumeLengthOrPercent
(range, cssParserMode, ValueRangeAll, UnitlessQuirk::Allow)) { |
| 729 list->append(textIndent.release()); |
| 730 hasLengthOrPercentage = true; |
| 731 continue; |
| 732 } |
| 733 } |
| 734 |
| 735 if (RuntimeEnabledFeatures::css3TextEnabled()) { |
| 736 CSSValueID id = range.peek().id(); |
| 737 if (!hasEachLine && id == CSSValueEachLine) { |
| 738 list->append(consumeIdent(range)); |
| 739 hasEachLine = true; |
| 740 continue; |
| 741 } |
| 742 if (!hasHanging && id == CSSValueHanging) { |
| 743 list->append(consumeIdent(range)); |
| 744 hasHanging = true; |
| 745 continue; |
| 746 } |
| 747 } |
| 748 return nullptr; |
| 749 } while (!range.atEnd()); |
| 750 |
| 751 if (!hasLengthOrPercentage) |
| 752 return nullptr; |
| 753 |
| 754 return list.release(); |
| 755 } |
| 756 |
| 716 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
ID propId) | 757 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
ID propId) |
| 717 { | 758 { |
| 718 m_range.consumeWhitespace(); | 759 m_range.consumeWhitespace(); |
| 719 switch (propId) { | 760 switch (propId) { |
| 720 case CSSPropertyWillChange: | 761 case CSSPropertyWillChange: |
| 721 return consumeWillChange(m_range); | 762 return consumeWillChange(m_range); |
| 722 case CSSPropertyPage: | 763 case CSSPropertyPage: |
| 723 return consumePage(m_range); | 764 return consumePage(m_range); |
| 724 case CSSPropertyQuotes: | 765 case CSSPropertyQuotes: |
| 725 return consumeQuotes(m_range); | 766 return consumeQuotes(m_range); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 747 case CSSPropertyRotate: | 788 case CSSPropertyRotate: |
| 748 return consumeRotation(m_range); | 789 return consumeRotation(m_range); |
| 749 case CSSPropertyWebkitBorderHorizontalSpacing: | 790 case CSSPropertyWebkitBorderHorizontalSpacing: |
| 750 case CSSPropertyWebkitBorderVerticalSpacing: | 791 case CSSPropertyWebkitBorderVerticalSpacing: |
| 751 return consumeLength(m_range, m_context.mode(), ValueRangeNonNegative); | 792 return consumeLength(m_range, m_context.mode(), ValueRangeNonNegative); |
| 752 case CSSPropertyCounterIncrement: | 793 case CSSPropertyCounterIncrement: |
| 753 case CSSPropertyCounterReset: | 794 case CSSPropertyCounterReset: |
| 754 return consumeCounter(m_range, m_context.mode(), propId == CSSPropertyCo
unterIncrement ? 1 : 0); | 795 return consumeCounter(m_range, m_context.mode(), propId == CSSPropertyCo
unterIncrement ? 1 : 0); |
| 755 case CSSPropertySize: | 796 case CSSPropertySize: |
| 756 return consumeSize(m_range, m_context.mode()); | 797 return consumeSize(m_range, m_context.mode()); |
| 798 case CSSPropertyTextIndent: |
| 799 return consumeTextIndent(m_range, m_context.mode()); |
| 757 default: | 800 default: |
| 758 return nullptr; | 801 return nullptr; |
| 759 } | 802 } |
| 760 } | 803 } |
| 761 | 804 |
| 762 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse
rTokenRange& range) | 805 static PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceUnicodeRange(CSSParse
rTokenRange& range) |
| 763 { | 806 { |
| 764 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated
(); | 807 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated
(); |
| 765 | 808 |
| 766 do { | 809 do { |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 } | 1184 } |
| 1142 case CSSPropertyBorderSpacing: | 1185 case CSSPropertyBorderSpacing: |
| 1143 return consumeBorderSpacing(important); | 1186 return consumeBorderSpacing(important); |
| 1144 default: | 1187 default: |
| 1145 m_currentShorthand = oldShorthand; | 1188 m_currentShorthand = oldShorthand; |
| 1146 return false; | 1189 return false; |
| 1147 } | 1190 } |
| 1148 } | 1191 } |
| 1149 | 1192 |
| 1150 } // namespace blink | 1193 } // namespace blink |
| OLD | NEW |