Chromium Code Reviews| 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 "core/css/parser/CSSPropertyParser.h" | 5 #include "core/css/parser/CSSPropertyParser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "core/StylePropertyShorthand.h" | 8 #include "core/StylePropertyShorthand.h" |
| 9 #include "core/css/CSSBasicShapeValues.h" | 9 #include "core/css/CSSBasicShapeValues.h" |
| 10 #include "core/css/CSSContentDistributionValue.h" | 10 #include "core/css/CSSContentDistributionValue.h" |
| 11 #include "core/css/CSSCursorImageValue.h" | 11 #include "core/css/CSSCursorImageValue.h" |
| 12 #include "core/css/CSSCustomIdentValue.h" | 12 #include "core/css/CSSCustomIdentValue.h" |
| 13 #include "core/css/CSSFontFaceSrcValue.h" | 13 #include "core/css/CSSFontFaceSrcValue.h" |
| 14 #include "core/css/CSSFontFamilyValue.h" | 14 #include "core/css/CSSFontFamilyValue.h" |
|
Bugs Nash
2017/06/16 03:51:50
this can be deleted now
Jia
2017/06/19 03:54:41
Done.
| |
| 15 #include "core/css/CSSFunctionValue.h" | 15 #include "core/css/CSSFunctionValue.h" |
| 16 #include "core/css/CSSGridAutoRepeatValue.h" | 16 #include "core/css/CSSGridAutoRepeatValue.h" |
| 17 #include "core/css/CSSGridLineNamesValue.h" | 17 #include "core/css/CSSGridLineNamesValue.h" |
| 18 #include "core/css/CSSGridTemplateAreasValue.h" | 18 #include "core/css/CSSGridTemplateAreasValue.h" |
| 19 #include "core/css/CSSIdentifierValue.h" | 19 #include "core/css/CSSIdentifierValue.h" |
| 20 #include "core/css/CSSInheritedValue.h" | 20 #include "core/css/CSSInheritedValue.h" |
| 21 #include "core/css/CSSInitialValue.h" | 21 #include "core/css/CSSInitialValue.h" |
| 22 #include "core/css/CSSPendingSubstitutionValue.h" | 22 #include "core/css/CSSPendingSubstitutionValue.h" |
| 23 #include "core/css/CSSPrimitiveValueMappings.h" | 23 #include "core/css/CSSPrimitiveValueMappings.h" |
| 24 #include "core/css/CSSReflectValue.h" | 24 #include "core/css/CSSReflectValue.h" |
| 25 #include "core/css/CSSShadowValue.h" | 25 #include "core/css/CSSShadowValue.h" |
| 26 #include "core/css/CSSStringValue.h" | 26 #include "core/css/CSSStringValue.h" |
| 27 #include "core/css/CSSTimingFunctionValue.h" | 27 #include "core/css/CSSTimingFunctionValue.h" |
| 28 #include "core/css/CSSURIValue.h" | 28 #include "core/css/CSSURIValue.h" |
| 29 #include "core/css/CSSUnicodeRangeValue.h" | 29 #include "core/css/CSSUnicodeRangeValue.h" |
| 30 #include "core/css/CSSUnsetValue.h" | 30 #include "core/css/CSSUnsetValue.h" |
| 31 #include "core/css/CSSValuePair.h" | 31 #include "core/css/CSSValuePair.h" |
| 32 #include "core/css/CSSVariableReferenceValue.h" | 32 #include "core/css/CSSVariableReferenceValue.h" |
| 33 #include "core/css/HashTools.h" | 33 #include "core/css/HashTools.h" |
| 34 #include "core/css/parser/CSSParserFastPaths.h" | 34 #include "core/css/parser/CSSParserFastPaths.h" |
| 35 #include "core/css/parser/CSSParserIdioms.h" | 35 #include "core/css/parser/CSSParserIdioms.h" |
| 36 #include "core/css/parser/CSSParserLocalContext.h" | 36 #include "core/css/parser/CSSParserLocalContext.h" |
| 37 #include "core/css/parser/CSSPropertyParserHelpers.h" | 37 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 38 #include "core/css/parser/CSSVariableParser.h" | 38 #include "core/css/parser/CSSVariableParser.h" |
| 39 #include "core/css/parser/FontVariantLigaturesParser.h" | 39 #include "core/css/parser/FontVariantLigaturesParser.h" |
|
Bugs Nash
2017/06/16 03:51:50
this can be deleted now
Jia
2017/06/19 03:54:41
Done.
| |
| 40 #include "core/css/parser/FontVariantNumericParser.h" | 40 #include "core/css/parser/FontVariantNumericParser.h" |
|
Bugs Nash
2017/06/16 03:51:50
this can be deleted now
Jia
2017/06/19 03:54:41
Done.
| |
| 41 #include "core/css/properties/CSSPropertyAPIOffsetAnchor.h" | 41 #include "core/css/properties/CSSPropertyAPIOffsetAnchor.h" |
| 42 #include "core/css/properties/CSSPropertyAPIOffsetPosition.h" | 42 #include "core/css/properties/CSSPropertyAPIOffsetPosition.h" |
| 43 #include "core/css/properties/CSSPropertyAlignmentUtils.h" | 43 #include "core/css/properties/CSSPropertyAlignmentUtils.h" |
| 44 #include "core/css/properties/CSSPropertyAnimationNameUtils.h" | 44 #include "core/css/properties/CSSPropertyAnimationNameUtils.h" |
| 45 #include "core/css/properties/CSSPropertyBorderImageUtils.h" | 45 #include "core/css/properties/CSSPropertyBorderImageUtils.h" |
| 46 #include "core/css/properties/CSSPropertyColumnUtils.h" | 46 #include "core/css/properties/CSSPropertyColumnUtils.h" |
| 47 #include "core/css/properties/CSSPropertyDescriptor.h" | 47 #include "core/css/properties/CSSPropertyDescriptor.h" |
| 48 #include "core/css/properties/CSSPropertyFontUtils.h" | 48 #include "core/css/properties/CSSPropertyFontUtils.h" |
| 49 #include "core/css/properties/CSSPropertyLengthUtils.h" | 49 #include "core/css/properties/CSSPropertyLengthUtils.h" |
| 50 #include "core/css/properties/CSSPropertyMarginUtils.h" | 50 #include "core/css/properties/CSSPropertyMarginUtils.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 if (!CSSPropertyMetadata::IsProperty(unresolved_property)) | 271 if (!CSSPropertyMetadata::IsProperty(unresolved_property)) |
| 272 return false; | 272 return false; |
| 273 AddParsedProperty(property, CSSPropertyInvalid, *value, important); | 273 AddParsedProperty(property, CSSPropertyInvalid, *value, important); |
| 274 } else { | 274 } else { |
| 275 AddExpandedPropertyForValue(property, *value, important); | 275 AddExpandedPropertyForValue(property, *value, important); |
| 276 } | 276 } |
| 277 range_ = range_copy; | 277 range_ = range_copy; |
| 278 return true; | 278 return true; |
| 279 } | 279 } |
| 280 | 280 |
| 281 static CSSIdentifierValue* ConsumeFontVariantCSS21(CSSParserTokenRange& range) { | |
| 282 return ConsumeIdent<CSSValueNormal, CSSValueSmallCaps>(range); | |
| 283 } | |
| 284 | |
| 285 static CSSValue* ConsumeFontVariantList(CSSParserTokenRange& range) { | 281 static CSSValue* ConsumeFontVariantList(CSSParserTokenRange& range) { |
| 286 CSSValueList* values = CSSValueList::CreateCommaSeparated(); | 282 CSSValueList* values = CSSValueList::CreateCommaSeparated(); |
| 287 do { | 283 do { |
| 288 if (range.Peek().Id() == CSSValueAll) { | 284 if (range.Peek().Id() == CSSValueAll) { |
| 289 // FIXME: CSSPropertyParser::ParseFontVariant() implements | 285 // FIXME: CSSPropertyParser::ParseFontVariant() implements |
| 290 // the old css3 draft: | 286 // the old css3 draft: |
| 291 // http://www.w3.org/TR/2002/WD-css3-webfonts-20020802/#font-variant | 287 // http://www.w3.org/TR/2002/WD-css3-webfonts-20020802/#font-variant |
| 292 // 'all' is only allowed in @font-face and with no other values. | 288 // 'all' is only allowed in @font-face and with no other values. |
| 293 if (values->length()) | 289 if (values->length()) |
| 294 return nullptr; | 290 return nullptr; |
| 295 return ConsumeIdent(range); | 291 return ConsumeIdent(range); |
| 296 } | 292 } |
| 297 CSSIdentifierValue* font_variant = ConsumeFontVariantCSS21(range); | 293 CSSIdentifierValue* font_variant = |
| 294 CSSPropertyFontUtils::ConsumeFontVariantCSS21(range); | |
| 298 if (font_variant) | 295 if (font_variant) |
| 299 values->Append(*font_variant); | 296 values->Append(*font_variant); |
| 300 } while (ConsumeCommaIncludingWhitespace(range)); | 297 } while (ConsumeCommaIncludingWhitespace(range)); |
| 301 | 298 |
| 302 if (values->length()) | 299 if (values->length()) |
| 303 return values; | 300 return values; |
| 304 | 301 |
| 305 return nullptr; | 302 return nullptr; |
| 306 } | 303 } |
| 307 | 304 |
| (...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1845 break; | 1842 break; |
| 1846 } | 1843 } |
| 1847 | 1844 |
| 1848 if (!parsed_value || !range_.AtEnd()) | 1845 if (!parsed_value || !range_.AtEnd()) |
| 1849 return false; | 1846 return false; |
| 1850 | 1847 |
| 1851 AddParsedProperty(prop_id, CSSPropertyInvalid, *parsed_value, false); | 1848 AddParsedProperty(prop_id, CSSPropertyInvalid, *parsed_value, false); |
| 1852 return true; | 1849 return true; |
| 1853 } | 1850 } |
| 1854 | 1851 |
| 1855 bool CSSPropertyParser::ConsumeSystemFont(bool important) { | |
| 1856 CSSValueID system_font_id = range_.ConsumeIncludingWhitespace().Id(); | |
| 1857 DCHECK_GE(system_font_id, CSSValueCaption); | |
| 1858 DCHECK_LE(system_font_id, CSSValueStatusBar); | |
| 1859 if (!range_.AtEnd()) | |
| 1860 return false; | |
| 1861 | |
| 1862 FontStyle font_style = kFontStyleNormal; | |
| 1863 FontWeight font_weight = kFontWeightNormal; | |
| 1864 float font_size = 0; | |
| 1865 AtomicString font_family; | |
| 1866 LayoutTheme::GetTheme().SystemFont(system_font_id, font_style, font_weight, | |
| 1867 font_size, font_family); | |
| 1868 | |
| 1869 AddParsedProperty(CSSPropertyFontStyle, CSSPropertyFont, | |
| 1870 *CSSIdentifierValue::Create(font_style == kFontStyleItalic | |
| 1871 ? CSSValueItalic | |
| 1872 : CSSValueNormal), | |
| 1873 important); | |
| 1874 AddParsedProperty(CSSPropertyFontWeight, CSSPropertyFont, | |
| 1875 *CSSIdentifierValue::Create(font_weight), important); | |
| 1876 AddParsedProperty(CSSPropertyFontSize, CSSPropertyFont, | |
| 1877 *CSSPrimitiveValue::Create( | |
| 1878 font_size, CSSPrimitiveValue::UnitType::kPixels), | |
| 1879 important); | |
| 1880 CSSValueList* font_family_list = CSSValueList::CreateCommaSeparated(); | |
| 1881 font_family_list->Append(*CSSFontFamilyValue::Create(font_family)); | |
| 1882 AddParsedProperty(CSSPropertyFontFamily, CSSPropertyFont, *font_family_list, | |
| 1883 important); | |
| 1884 | |
| 1885 AddParsedProperty(CSSPropertyFontStretch, CSSPropertyFont, | |
| 1886 *CSSIdentifierValue::Create(CSSValueNormal), important); | |
| 1887 AddParsedProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, | |
| 1888 *CSSIdentifierValue::Create(CSSValueNormal), important); | |
| 1889 AddParsedProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, | |
| 1890 *CSSIdentifierValue::Create(CSSValueNormal), important); | |
| 1891 AddParsedProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, | |
| 1892 *CSSIdentifierValue::Create(CSSValueNormal), important); | |
| 1893 AddParsedProperty(CSSPropertyLineHeight, CSSPropertyFont, | |
| 1894 *CSSIdentifierValue::Create(CSSValueNormal), important); | |
| 1895 return true; | |
| 1896 } | |
| 1897 | |
| 1898 bool CSSPropertyParser::ConsumeFont(bool important) { | |
| 1899 // Let's check if there is an inherit or initial somewhere in the shorthand. | |
| 1900 CSSParserTokenRange range = range_; | |
| 1901 while (!range.AtEnd()) { | |
| 1902 CSSValueID id = range.ConsumeIncludingWhitespace().Id(); | |
| 1903 if (id == CSSValueInherit || id == CSSValueInitial) | |
| 1904 return false; | |
| 1905 } | |
| 1906 // Optional font-style, font-variant, font-stretch and font-weight. | |
| 1907 CSSIdentifierValue* font_style = nullptr; | |
| 1908 CSSIdentifierValue* font_variant_caps = nullptr; | |
| 1909 CSSIdentifierValue* font_weight = nullptr; | |
| 1910 CSSIdentifierValue* font_stretch = nullptr; | |
| 1911 while (!range_.AtEnd()) { | |
| 1912 CSSValueID id = range_.Peek().Id(); | |
| 1913 if (!font_style && CSSParserFastPaths::IsValidKeywordPropertyAndValue( | |
| 1914 CSSPropertyFontStyle, id, context_->Mode())) { | |
| 1915 font_style = ConsumeIdent(range_); | |
| 1916 continue; | |
| 1917 } | |
| 1918 if (!font_variant_caps && | |
| 1919 (id == CSSValueNormal || id == CSSValueSmallCaps)) { | |
| 1920 // Font variant in the shorthand is particular, it only accepts normal or | |
| 1921 // small-caps. | |
| 1922 // See https://drafts.csswg.org/css-fonts/#propdef-font | |
| 1923 font_variant_caps = ConsumeFontVariantCSS21(range_); | |
| 1924 if (font_variant_caps) | |
| 1925 continue; | |
| 1926 } | |
| 1927 if (!font_weight) { | |
| 1928 font_weight = CSSPropertyFontUtils::ConsumeFontWeight(range_); | |
| 1929 if (font_weight) | |
| 1930 continue; | |
| 1931 } | |
| 1932 if (!font_stretch && CSSParserFastPaths::IsValidKeywordPropertyAndValue( | |
| 1933 CSSPropertyFontStretch, id, context_->Mode())) | |
| 1934 font_stretch = ConsumeIdent(range_); | |
| 1935 else | |
| 1936 break; | |
| 1937 } | |
| 1938 | |
| 1939 if (range_.AtEnd()) | |
| 1940 return false; | |
| 1941 | |
| 1942 AddParsedProperty( | |
| 1943 CSSPropertyFontStyle, CSSPropertyFont, | |
| 1944 font_style ? *font_style : *CSSIdentifierValue::Create(CSSValueNormal), | |
| 1945 important); | |
| 1946 AddParsedProperty(CSSPropertyFontVariantCaps, CSSPropertyFont, | |
| 1947 font_variant_caps | |
| 1948 ? *font_variant_caps | |
| 1949 : *CSSIdentifierValue::Create(CSSValueNormal), | |
| 1950 important); | |
| 1951 AddParsedProperty(CSSPropertyFontVariantLigatures, CSSPropertyFont, | |
| 1952 *CSSIdentifierValue::Create(CSSValueNormal), important); | |
| 1953 AddParsedProperty(CSSPropertyFontVariantNumeric, CSSPropertyFont, | |
| 1954 *CSSIdentifierValue::Create(CSSValueNormal), important); | |
| 1955 | |
| 1956 AddParsedProperty( | |
| 1957 CSSPropertyFontWeight, CSSPropertyFont, | |
| 1958 font_weight ? *font_weight : *CSSIdentifierValue::Create(CSSValueNormal), | |
| 1959 important); | |
| 1960 AddParsedProperty(CSSPropertyFontStretch, CSSPropertyFont, | |
| 1961 font_stretch ? *font_stretch | |
| 1962 : *CSSIdentifierValue::Create(CSSValueNormal), | |
| 1963 important); | |
| 1964 | |
| 1965 // Now a font size _must_ come. | |
| 1966 CSSValue* font_size = | |
| 1967 CSSPropertyFontUtils::ConsumeFontSize(range_, context_->Mode()); | |
| 1968 if (!font_size || range_.AtEnd()) | |
| 1969 return false; | |
| 1970 | |
| 1971 AddParsedProperty(CSSPropertyFontSize, CSSPropertyFont, *font_size, | |
| 1972 important); | |
| 1973 | |
| 1974 if (ConsumeSlashIncludingWhitespace(range_)) { | |
| 1975 CSSValue* line_height = | |
| 1976 CSSPropertyFontUtils::ConsumeLineHeight(range_, context_->Mode()); | |
| 1977 if (!line_height) | |
| 1978 return false; | |
| 1979 AddParsedProperty(CSSPropertyLineHeight, CSSPropertyFont, *line_height, | |
| 1980 important); | |
| 1981 } else { | |
| 1982 AddParsedProperty(CSSPropertyLineHeight, CSSPropertyFont, | |
| 1983 *CSSIdentifierValue::Create(CSSValueNormal), important); | |
| 1984 } | |
| 1985 | |
| 1986 // Font family must come now. | |
| 1987 CSSValue* parsed_family_value = | |
| 1988 CSSPropertyFontUtils::ConsumeFontFamily(range_); | |
| 1989 if (!parsed_family_value) | |
| 1990 return false; | |
| 1991 | |
| 1992 AddParsedProperty(CSSPropertyFontFamily, CSSPropertyFont, | |
| 1993 *parsed_family_value, important); | |
| 1994 | |
| 1995 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requires | |
| 1996 // that "font-stretch", "font-size-adjust", and "font-kerning" be reset to | |
| 1997 // their initial values but we don't seem to support them at the moment. They | |
| 1998 // should also be added here once implemented. | |
| 1999 return range_.AtEnd(); | |
| 2000 } | |
| 2001 | |
| 2002 bool CSSPropertyParser::ConsumeFontVariantShorthand(bool important) { | |
| 2003 if (IdentMatches<CSSValueNormal, CSSValueNone>(range_.Peek().Id())) { | |
| 2004 AddParsedProperty(CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, | |
| 2005 *ConsumeIdent(range_), important); | |
| 2006 AddParsedProperty(CSSPropertyFontVariantCaps, CSSPropertyFontVariant, | |
| 2007 *CSSIdentifierValue::Create(CSSValueNormal), important); | |
| 2008 return range_.AtEnd(); | |
| 2009 } | |
| 2010 | |
| 2011 CSSIdentifierValue* caps_value = nullptr; | |
| 2012 FontVariantLigaturesParser ligatures_parser; | |
| 2013 FontVariantNumericParser numeric_parser; | |
| 2014 do { | |
| 2015 FontVariantLigaturesParser::ParseResult ligatures_parse_result = | |
| 2016 ligatures_parser.ConsumeLigature(range_); | |
| 2017 FontVariantNumericParser::ParseResult numeric_parse_result = | |
| 2018 numeric_parser.ConsumeNumeric(range_); | |
| 2019 if (ligatures_parse_result == | |
| 2020 FontVariantLigaturesParser::ParseResult::kConsumedValue || | |
| 2021 numeric_parse_result == | |
| 2022 FontVariantNumericParser::ParseResult::kConsumedValue) | |
| 2023 continue; | |
| 2024 | |
| 2025 if (ligatures_parse_result == | |
| 2026 FontVariantLigaturesParser::ParseResult::kDisallowedValue || | |
| 2027 numeric_parse_result == | |
| 2028 FontVariantNumericParser::ParseResult::kDisallowedValue) | |
| 2029 return false; | |
| 2030 | |
| 2031 CSSValueID id = range_.Peek().Id(); | |
| 2032 switch (id) { | |
| 2033 case CSSValueSmallCaps: | |
| 2034 case CSSValueAllSmallCaps: | |
| 2035 case CSSValuePetiteCaps: | |
| 2036 case CSSValueAllPetiteCaps: | |
| 2037 case CSSValueUnicase: | |
| 2038 case CSSValueTitlingCaps: | |
| 2039 // Only one caps value permitted in font-variant grammar. | |
| 2040 if (caps_value) | |
| 2041 return false; | |
| 2042 caps_value = ConsumeIdent(range_); | |
| 2043 break; | |
| 2044 default: | |
| 2045 return false; | |
| 2046 } | |
| 2047 } while (!range_.AtEnd()); | |
| 2048 | |
| 2049 AddParsedProperty(CSSPropertyFontVariantLigatures, CSSPropertyFontVariant, | |
| 2050 *ligatures_parser.FinalizeValue(), important); | |
| 2051 AddParsedProperty(CSSPropertyFontVariantNumeric, CSSPropertyFontVariant, | |
| 2052 *numeric_parser.FinalizeValue(), important); | |
| 2053 AddParsedProperty( | |
| 2054 CSSPropertyFontVariantCaps, CSSPropertyFontVariant, | |
| 2055 caps_value ? *caps_value : *CSSIdentifierValue::Create(CSSValueNormal), | |
| 2056 important); | |
| 2057 return true; | |
| 2058 } | |
| 2059 | |
| 2060 bool CSSPropertyParser::ConsumeBorderSpacing(bool important) { | 1852 bool CSSPropertyParser::ConsumeBorderSpacing(bool important) { |
| 2061 CSSValue* horizontal_spacing = ConsumeLength( | 1853 CSSValue* horizontal_spacing = ConsumeLength( |
| 2062 range_, context_->Mode(), kValueRangeNonNegative, UnitlessQuirk::kAllow); | 1854 range_, context_->Mode(), kValueRangeNonNegative, UnitlessQuirk::kAllow); |
| 2063 if (!horizontal_spacing) | 1855 if (!horizontal_spacing) |
| 2064 return false; | 1856 return false; |
| 2065 CSSValue* vertical_spacing = horizontal_spacing; | 1857 CSSValue* vertical_spacing = horizontal_spacing; |
| 2066 if (!range_.AtEnd()) { | 1858 if (!range_.AtEnd()) { |
| 2067 vertical_spacing = | 1859 vertical_spacing = |
| 2068 ConsumeLength(range_, context_->Mode(), kValueRangeNonNegative, | 1860 ConsumeLength(range_, context_->Mode(), kValueRangeNonNegative, |
| 2069 UnitlessQuirk::kAllow); | 1861 UnitlessQuirk::kAllow); |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3067 const CSSPropertyDescriptor& css_property_desc = | 2859 const CSSPropertyDescriptor& css_property_desc = |
| 3068 CSSPropertyDescriptor::Get(property); | 2860 CSSPropertyDescriptor::Get(property); |
| 3069 if (css_property_desc.parseShorthand) { | 2861 if (css_property_desc.parseShorthand) { |
| 3070 return css_property_desc.parseShorthand( | 2862 return css_property_desc.parseShorthand( |
| 3071 important, range_, context_, | 2863 important, range_, context_, |
| 3072 CSSParserLocalContext(isPropertyAlias(unresolved_property)), | 2864 CSSParserLocalContext(isPropertyAlias(unresolved_property)), |
| 3073 *parsed_properties_); | 2865 *parsed_properties_); |
| 3074 } | 2866 } |
| 3075 | 2867 |
| 3076 switch (property) { | 2868 switch (property) { |
| 3077 case CSSPropertyOverflow: { | |
| 3078 CSSValueID id = range_.ConsumeIncludingWhitespace().Id(); | |
| 3079 if (!CSSParserFastPaths::IsValidKeywordPropertyAndValue( | |
| 3080 CSSPropertyOverflowY, id, context_->Mode())) | |
| 3081 return false; | |
| 3082 if (!range_.AtEnd()) | |
| 3083 return false; | |
| 3084 CSSValue* overflow_y_value = CSSIdentifierValue::Create(id); | |
| 3085 | |
| 3086 CSSValue* overflow_x_value = nullptr; | |
| 3087 | |
| 3088 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. | |
| 3089 // If | |
| 3090 // this value has been set using the shorthand, then for now overflow-x | |
| 3091 // will default to auto, but once we implement pagination controls, it | |
| 3092 // should default to hidden. If the overflow-y value is anything but | |
| 3093 // paged-x or paged-y, then overflow-x and overflow-y should have the | |
| 3094 // same | |
| 3095 // value. | |
| 3096 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY) | |
| 3097 overflow_x_value = CSSIdentifierValue::Create(CSSValueAuto); | |
| 3098 else | |
| 3099 overflow_x_value = overflow_y_value; | |
| 3100 AddParsedProperty(CSSPropertyOverflowX, CSSPropertyOverflow, | |
| 3101 *overflow_x_value, important); | |
| 3102 AddParsedProperty(CSSPropertyOverflowY, CSSPropertyOverflow, | |
| 3103 *overflow_y_value, important); | |
| 3104 return true; | |
| 3105 } | |
| 3106 case CSSPropertyFont: { | |
| 3107 const CSSParserToken& token = range_.Peek(); | |
| 3108 if (token.Id() >= CSSValueCaption && token.Id() <= CSSValueStatusBar) | |
| 3109 return ConsumeSystemFont(important); | |
| 3110 return ConsumeFont(important); | |
| 3111 } | |
| 3112 case CSSPropertyFontVariant: | |
| 3113 return ConsumeFontVariantShorthand(important); | |
| 3114 case CSSPropertyBorderSpacing: | 2869 case CSSPropertyBorderSpacing: |
| 3115 return ConsumeBorderSpacing(important); | 2870 return ConsumeBorderSpacing(important); |
| 3116 case CSSPropertyColumns: | 2871 case CSSPropertyColumns: |
| 3117 return ConsumeColumns(important); | 2872 return ConsumeColumns(important); |
| 3118 case CSSPropertyAnimation: | 2873 case CSSPropertyAnimation: |
| 3119 return ConsumeAnimationShorthand( | 2874 return ConsumeAnimationShorthand( |
| 3120 animationShorthandForParsing(), | 2875 animationShorthandForParsing(), |
| 3121 unresolved_property == CSSPropertyAliasWebkitAnimation, important); | 2876 unresolved_property == CSSPropertyAliasWebkitAnimation, important); |
| 3122 case CSSPropertyTransition: | 2877 case CSSPropertyTransition: |
| 3123 return ConsumeAnimationShorthand(transitionShorthandForParsing(), false, | 2878 return ConsumeAnimationShorthand(transitionShorthandForParsing(), false, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3261 case CSSPropertyPlaceItems: | 3016 case CSSPropertyPlaceItems: |
| 3262 return ConsumePlaceItemsShorthand(important); | 3017 return ConsumePlaceItemsShorthand(important); |
| 3263 case CSSPropertyPlaceSelf: | 3018 case CSSPropertyPlaceSelf: |
| 3264 return ConsumePlaceSelfShorthand(important); | 3019 return ConsumePlaceSelfShorthand(important); |
| 3265 default: | 3020 default: |
| 3266 return false; | 3021 return false; |
| 3267 } | 3022 } |
| 3268 } | 3023 } |
| 3269 | 3024 |
| 3270 } // namespace blink | 3025 } // namespace blink |
| OLD | NEW |