| 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 |
| 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(Document*, const KURL& baseURL = KURL(), const String& char
set = emptyString()); | 66 CSSParserContext(Document*, const KURL& baseURL = KURL(), const String& char
set = emptyString()); |
| 65 | 67 |
| 66 KURL baseURL; | 68 KURL baseURL; |
| 67 String charset; | 69 String charset; |
| 68 CSSParserMode mode; | 70 CSSParserMode mode; |
| 69 bool isHTMLDocument; | 71 bool isHTMLDocument; |
| 70 bool isCSSCustomFilterEnabled; | 72 bool isCSSCustomFilterEnabled; |
| 71 bool isCSSStickyPositionEnabled; | 73 bool isCSSStickyPositionEnabled; |
| 72 bool isCSSCompositingEnabled; | 74 bool isCSSCompositingEnabled; |
| 73 bool isCSSTouchActionEnabled; | 75 bool isCSSTouchActionEnabled; |
| 74 bool needsSiteSpecificQuirks; | 76 bool needsSiteSpecificQuirks; |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 bool operator==(const CSSParserContext&, const CSSParserContext&); | 79 bool operator==(const CSSParserContext&, const CSSParserContext&); |
| 78 inline bool operator!=(const CSSParserContext& a, const CSSParserContext& b) { r
eturn !(a == b); } | 80 inline bool operator!=(const CSSParserContext& a, const CSSParserContext& b) { r
eturn !(a == b); } |
| 79 | 81 |
| 80 const CSSParserContext& strictCSSParserContext(); | 82 const CSSParserContext& strictCSSParserContext(); |
| 81 | 83 |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 #endif // CSSParserMode_h | 86 #endif // CSSParserMode_h |
| OLD | NEW |