| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
| 10 * | 10 * |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size
> || [ portrait | landscape] ] | 480 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size
> || [ portrait | landscape] ] |
| 481 return parseSize(propId, important); | 481 return parseSize(propId, important); |
| 482 | 482 |
| 483 case CSSPropertyQuotes: // [<string> <string>]+ | none | 483 case CSSPropertyQuotes: // [<string> <string>]+ | none |
| 484 if (id == CSSValueNone) | 484 if (id == CSSValueNone) |
| 485 validPrimitive = true; | 485 validPrimitive = true; |
| 486 else | 486 else |
| 487 parsedValue = parseQuotes(); | 487 parsedValue = parseQuotes(); |
| 488 break; | 488 break; |
| 489 | 489 |
| 490 case CSSPropertyContent: // [ <string> | <uri> | <counter> | at
tr(X) | open-quote | | |
| 491 // close-quote | no-open-quote | no-close-quote ]+ | inherit | |
| 492 return parseContent(propId, important); | |
| 493 | |
| 494 case CSSPropertyClip: // <shape> | auto | inherit | 490 case CSSPropertyClip: // <shape> | auto | inherit |
| 495 if (id == CSSValueAuto) | 491 if (id == CSSValueAuto) |
| 496 validPrimitive = true; | 492 validPrimitive = true; |
| 497 else if (value->unit == CSSParserValue::Function) | 493 else if (value->unit == CSSParserValue::Function) |
| 498 return parseClipShape(propId, important); | 494 return parseClipShape(propId, important); |
| 499 break; | 495 break; |
| 500 | 496 |
| 501 /* Start of supported CSS properties with validation. This is needed for par
seShorthand to work | 497 /* Start of supported CSS properties with validation. This is needed for par
seShorthand to work |
| 502 * correctly and allows optimization in blink::applyRule(..) | 498 * correctly and allows optimization in blink::applyRule(..) |
| 503 */ | 499 */ |
| (...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1875 return nullptr; | 1871 return nullptr; |
| 1876 parsedValue = CSSPrimitiveValue::create(val->string, CSSPrimitiveValue::
CSS_STRING); | 1872 parsedValue = CSSPrimitiveValue::create(val->string, CSSPrimitiveValue::
CSS_STRING); |
| 1877 values->append(parsedValue.release()); | 1873 values->append(parsedValue.release()); |
| 1878 m_valueList->next(); | 1874 m_valueList->next(); |
| 1879 } | 1875 } |
| 1880 if (values->length() && values->length() % 2 == 0) | 1876 if (values->length() && values->length() % 2 == 0) |
| 1881 return values.release(); | 1877 return values.release(); |
| 1882 return nullptr; | 1878 return nullptr; |
| 1883 } | 1879 } |
| 1884 | 1880 |
| 1885 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open
-quote | no-close-quote ]+ | inherit | |
| 1886 // in CSS 2.1 this got somewhat reduced: | |
| 1887 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-qu
ote ]+ | inherit | |
| 1888 bool CSSPropertyParser::parseContent(CSSPropertyID propId, bool important) | |
| 1889 { | |
| 1890 RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated(); | |
| 1891 | |
| 1892 while (CSSParserValue* val = m_valueList->current()) { | |
| 1893 RefPtr<CSSValue> parsedValue = nullptr; | |
| 1894 if (val->unit == CSSPrimitiveValue::CSS_URI) { | |
| 1895 // url | |
| 1896 parsedValue = createCSSImageValueWithReferrer(val->string, completeU
RL(val->string)); | |
| 1897 } else if (val->unit == CSSParserValue::Function) { | |
| 1898 // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradie
nt(...) | |
| 1899 CSSParserValueList* args = val->function->args.get(); | |
| 1900 if (!args) | |
| 1901 return false; | |
| 1902 if (equalIgnoringCase(val->function->name, "attr(")) { | |
| 1903 parsedValue = parseAttr(args); | |
| 1904 if (!parsedValue) | |
| 1905 return false; | |
| 1906 } else if (equalIgnoringCase(val->function->name, "-webkit-image-set
(")) { | |
| 1907 parsedValue = parseImageSet(m_valueList); | |
| 1908 if (!parsedValue) | |
| 1909 return false; | |
| 1910 } else if (isGeneratedImageValue(val)) { | |
| 1911 if (!parseGeneratedImage(m_valueList, parsedValue)) | |
| 1912 return false; | |
| 1913 } else | |
| 1914 return false; | |
| 1915 } else if (val->unit == CSSPrimitiveValue::CSS_IDENT) { | |
| 1916 // inherit | |
| 1917 // FIXME: These are not yet implemented (http://bugs.webkit.org/show
_bug.cgi?id=6503). | |
| 1918 // none | |
| 1919 // normal | |
| 1920 switch (val->id) { | |
| 1921 case CSSValueNone: | |
| 1922 case CSSValueNormal: | |
| 1923 parsedValue = cssValuePool().createIdentifierValue(val->id); | |
| 1924 default: | |
| 1925 break; | |
| 1926 } | |
| 1927 } else if (val->unit == CSSPrimitiveValue::CSS_STRING) { | |
| 1928 parsedValue = createPrimitiveStringValue(val); | |
| 1929 } | |
| 1930 if (!parsedValue) | |
| 1931 break; | |
| 1932 values->append(parsedValue.release()); | |
| 1933 m_valueList->next(); | |
| 1934 } | |
| 1935 | |
| 1936 if (values->length()) { | |
| 1937 addProperty(propId, values.release(), important); | |
| 1938 m_valueList->next(); | |
| 1939 return true; | |
| 1940 } | |
| 1941 | |
| 1942 return false; | |
| 1943 } | |
| 1944 | |
| 1945 PassRefPtr<CSSValue> CSSPropertyParser::parseAttr(CSSParserValueList* args) | 1881 PassRefPtr<CSSValue> CSSPropertyParser::parseAttr(CSSParserValueList* args) |
| 1946 { | 1882 { |
| 1947 if (args->size() != 1) | 1883 if (args->size() != 1) |
| 1948 return nullptr; | 1884 return nullptr; |
| 1949 | 1885 |
| 1950 CSSParserValue* a = args->current(); | 1886 CSSParserValue* a = args->current(); |
| 1951 | 1887 |
| 1952 if (a->unit != CSSPrimitiveValue::CSS_IDENT) | 1888 if (a->unit != CSSPrimitiveValue::CSS_IDENT) |
| 1953 return nullptr; | 1889 return nullptr; |
| 1954 | 1890 |
| (...skipping 4364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6319 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 6255 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 6320 } | 6256 } |
| 6321 | 6257 |
| 6322 bool CSSPropertyParser::isSystemColor(int id) | 6258 bool CSSPropertyParser::isSystemColor(int id) |
| 6323 { | 6259 { |
| 6324 // FIXME(sky): remove | 6260 // FIXME(sky): remove |
| 6325 return false; | 6261 return false; |
| 6326 } | 6262 } |
| 6327 | 6263 |
| 6328 } // namespace blink | 6264 } // namespace blink |
| OLD | NEW |