| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 3 * Copyright (C) 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above | 9 * 1. Redistributions of source code must retain the above |
| 10 * copyright notice, this list of conditions and the following | 10 * copyright notice, this list of conditions and the following |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 class Document; | 38 class Document; |
| 39 | 39 |
| 40 enum CSSParserMode { | 40 enum CSSParserMode { |
| 41 CSSQuirksMode, | 41 CSSQuirksMode, |
| 42 CSSStrictMode, | 42 CSSStrictMode, |
| 43 // SVG should always be in strict mode. For SVG attributes, the rules differ
to strict sometimes. | 43 // SVG should always be in strict mode. For SVG attributes, the rules differ
to strict sometimes. |
| 44 SVGAttributeMode, | 44 SVGAttributeMode, |
| 45 // User agent style sheet should always be in strict mode. Enables internal | 45 // User agent style sheet should always be in strict mode. Enables internal |
| 46 // only properties and values. | 46 // only properties and values. |
| 47 UASheetMode | 47 UASheetMode, |
| 48 // Parsing @viewport descriptors. Always strict. Set as mode on StylePropert
ySet |
| 49 // to make sure CSSOM modifications use CSSParser::parseViewportProperty. |
| 50 ViewportMode |
| 48 }; | 51 }; |
| 49 | 52 |
| 50 inline CSSParserMode strictToCSSParserMode(bool inStrictMode) | 53 inline CSSParserMode strictToCSSParserMode(bool inStrictMode) |
| 51 { | 54 { |
| 52 return inStrictMode ? CSSStrictMode : CSSQuirksMode; | 55 return inStrictMode ? CSSStrictMode : CSSQuirksMode; |
| 53 } | 56 } |
| 54 | 57 |
| 55 inline bool isStrictParserMode(CSSParserMode cssParserMode) | 58 inline bool isStrictParserMode(CSSParserMode cssParserMode) |
| 56 { | 59 { |
| 57 return cssParserMode == CSSStrictMode || cssParserMode == SVGAttributeMode |
| cssParserMode == UASheetMode; | 60 return cssParserMode != CSSQuirksMode; |
| 58 } | 61 } |
| 59 | 62 |
| 60 struct CSSParserContext { | 63 struct CSSParserContext { |
| 61 WTF_MAKE_FAST_ALLOCATED; | 64 WTF_MAKE_FAST_ALLOCATED; |
| 62 public: | 65 public: |
| 63 CSSParserContext(CSSParserMode, const KURL& baseURL = KURL()); | 66 CSSParserContext(CSSParserMode, const KURL& baseURL = KURL()); |
| 64 CSSParserContext(const Document&, const KURL& baseURL = KURL(), const String
& charset = emptyString()); | 67 CSSParserContext(const Document&, const KURL& baseURL = KURL(), const String
& charset = emptyString()); |
| 65 | 68 |
| 66 KURL baseURL; | 69 KURL baseURL; |
| 67 String charset; | 70 String charset; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 79 }; | 82 }; |
| 80 | 83 |
| 81 bool operator==(const CSSParserContext&, const CSSParserContext&); | 84 bool operator==(const CSSParserContext&, const CSSParserContext&); |
| 82 inline bool operator!=(const CSSParserContext& a, const CSSParserContext& b) { r
eturn !(a == b); } | 85 inline bool operator!=(const CSSParserContext& a, const CSSParserContext& b) { r
eturn !(a == b); } |
| 83 | 86 |
| 84 const CSSParserContext& strictCSSParserContext(); | 87 const CSSParserContext& strictCSSParserContext(); |
| 85 | 88 |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 #endif // CSSParserMode_h | 91 #endif // CSSParserMode_h |
| OLD | NEW |