| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #ifndef CSSParserMode_h | 31 #ifndef CSSParserMode_h |
| 32 #define CSSParserMode_h | 32 #define CSSParserMode_h |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 // Must not grow beyond 3 bits, due to packing in StylePropertySet. | 36 // Must not grow beyond 3 bits, due to packing in StylePropertySet. |
| 37 enum CSSParserMode { | 37 enum CSSParserMode { |
| 38 HTMLStandardMode, | 38 HTMLStandardMode, |
| 39 HTMLQuirksMode, | 39 HTMLQuirksMode, |
| 40 // HTML attributes are parsed in quirks mode but also allows internal | |
| 41 // properties and values. | |
| 42 HTMLAttributeMode, | |
| 43 // SVG attributes are parsed in quirks mode but rules differ slightly. | 40 // SVG attributes are parsed in quirks mode but rules differ slightly. |
| 44 SVGAttributeMode, | 41 SVGAttributeMode, |
| 45 // @viewport/@font-face rules are specially tagged in StylePropertySet so | 42 // @viewport/@font-face rules are specially tagged in StylePropertySet so |
| 46 // CSSOM modifications don't treat them as style rules. | 43 // CSSOM modifications don't treat them as style rules. |
| 47 CSSViewportRuleMode, | 44 CSSViewportRuleMode, |
| 48 CSSFontFaceRuleMode, | 45 CSSFontFaceRuleMode, |
| 49 // User agent stylesheets are parsed in standards mode but also allows | 46 // User agent stylesheets are parsed in standards mode but also allows |
| 50 // internal properties and values. | 47 // internal properties and values. |
| 51 UASheetMode | 48 UASheetMode |
| 52 }; | 49 }; |
| 53 | 50 |
| 54 inline bool isQuirksModeBehavior(CSSParserMode mode) { | 51 inline bool isQuirksModeBehavior(CSSParserMode mode) { |
| 55 return mode == HTMLQuirksMode; // || mode == HTMLAttributeMode; | 52 return mode == HTMLQuirksMode; |
| 56 } | 53 } |
| 57 | 54 |
| 58 inline bool isUASheetBehavior(CSSParserMode mode) { | 55 inline bool isUASheetBehavior(CSSParserMode mode) { |
| 59 return mode == UASheetMode; | 56 return mode == UASheetMode; |
| 60 } | 57 } |
| 61 | 58 |
| 62 inline bool isUnitLessLengthParsingEnabledForMode(CSSParserMode mode) { | |
| 63 return mode == HTMLAttributeMode || mode == SVGAttributeMode; | |
| 64 } | |
| 65 | |
| 66 inline bool isCSSViewportParsingEnabledForMode(CSSParserMode mode) { | 59 inline bool isCSSViewportParsingEnabledForMode(CSSParserMode mode) { |
| 67 return mode == CSSViewportRuleMode; | 60 return mode == CSSViewportRuleMode; |
| 68 } | 61 } |
| 69 | 62 |
| 70 inline bool isUseCounterEnabledForMode(CSSParserMode mode) { | 63 inline bool isUseCounterEnabledForMode(CSSParserMode mode) { |
| 71 // We don't count the UA style sheet in our statistics. | 64 // We don't count the UA style sheet in our statistics. |
| 72 return mode != UASheetMode; | 65 return mode != UASheetMode; |
| 73 } | 66 } |
| 74 | 67 |
| 75 } // namespace blink | 68 } // namespace blink |
| 76 | 69 |
| 77 #endif // CSSParserMode_h | 70 #endif // CSSParserMode_h |
| OLD | NEW |