Chromium Code Reviews| 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. | |
| 49 ViewportMode | |
|
eseidel
2013/09/17 22:26:00
If you're willing to go one more round here, it wo
rune
2013/09/18 08:13:09
The main thing about this mode is to use viewport
| |
| 48 }; | 50 }; |
| 49 | 51 |
| 50 inline CSSParserMode strictToCSSParserMode(bool inStrictMode) | 52 inline CSSParserMode strictToCSSParserMode(bool inStrictMode) |
| 51 { | 53 { |
| 52 return inStrictMode ? CSSStrictMode : CSSQuirksMode; | 54 return inStrictMode ? CSSStrictMode : CSSQuirksMode; |
| 53 } | 55 } |
| 54 | 56 |
| 55 inline bool isStrictParserMode(CSSParserMode cssParserMode) | 57 inline bool isStrictParserMode(CSSParserMode cssParserMode) |
| 56 { | 58 { |
| 57 return cssParserMode == CSSStrictMode || cssParserMode == SVGAttributeMode | | cssParserMode == UASheetMode; | 59 return cssParserMode != CSSQuirksMode; |
| 58 } | 60 } |
| 59 | 61 |
| 60 struct CSSParserContext { | 62 struct CSSParserContext { |
| 61 WTF_MAKE_FAST_ALLOCATED; | 63 WTF_MAKE_FAST_ALLOCATED; |
| 62 public: | 64 public: |
| 63 CSSParserContext(CSSParserMode, const KURL& baseURL = KURL()); | 65 CSSParserContext(CSSParserMode, const KURL& baseURL = KURL()); |
| 64 CSSParserContext(const Document&, const KURL& baseURL = KURL(), const String & charset = emptyString()); | 66 CSSParserContext(const Document&, const KURL& baseURL = KURL(), const String & charset = emptyString()); |
| 65 | 67 |
| 66 KURL baseURL; | 68 KURL baseURL; |
| 67 String charset; | 69 String charset; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 bool operator==(const CSSParserContext&, const CSSParserContext&); | 83 bool operator==(const CSSParserContext&, const CSSParserContext&); |
| 82 inline bool operator!=(const CSSParserContext& a, const CSSParserContext& b) { r eturn !(a == b); } | 84 inline bool operator!=(const CSSParserContext& a, const CSSParserContext& b) { r eturn !(a == b); } |
| 83 | 85 |
| 84 const CSSParserContext& strictCSSParserContext(); | 86 const CSSParserContext& strictCSSParserContext(); |
| 85 | 87 |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 #endif // CSSParserMode_h | 90 #endif // CSSParserMode_h |
| OLD | NEW |